Clean up the oopsie. Rebuild the blank exercises.

This commit is contained in:
Michael Frank
2021-05-09 00:39:21 +12:00
parent b984cb4c6f
commit d28d80c46f
1565 changed files with 27186 additions and 199003 deletions
+34 -11
View File
@@ -6,7 +6,7 @@
## Install
```
$ npm install --save locate-path
$ npm install locate-path
```
@@ -19,24 +19,24 @@ const locatePath = require('locate-path');
const files = [
'unicorn.png',
'rainbow.png', // only this one actually exists on disk
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
locatePath(files).then(foundPath => {
console.log(foundPath);
(async () => {
console(await locatePath(files));
//=> 'rainbow'
});
})();
```
## API
### locatePath(input, [options])
### locatePath(paths, [options])
Returns a `Promise` for the first path that exists or `undefined` if none exists.
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
#### input
#### paths
Type: `Iterable<string>`
@@ -59,7 +59,7 @@ Number of concurrently pending promises.
Type: `boolean`<br>
Default: `true`
Preserve `input` order when searching.
Preserve `paths` order when searching.
Disable this to improve performance if you don't care about the order.
@@ -70,11 +70,26 @@ Default: `process.cwd()`
Current working directory.
### locatePath.sync(input, [options])
##### type
Type: `string`<br>
Default: `file`<br>
Values: `file` `directory`
The type of paths that can match.
##### allowSymlinks
Type: `boolean`<br>
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### locatePath.sync(paths, [options])
Returns the first path that exists or `undefined` if none exists.
#### input
#### paths
Type: `Iterable<string>`
@@ -88,6 +103,14 @@ Type: `Object`
Same as above.
##### type
Same as above.
##### allowSymlinks
Same as above.
## Related