Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/p-locate/readme.md')
-rw-r--r--node_modules/p-locate/readme.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md
index 68b96a47e..3b0173bc4 100644
--- a/node_modules/p-locate/readme.md
+++ b/node_modules/p-locate/readme.md
@@ -8,7 +8,7 @@ Think of it like an async version of [`Array#find`](https://developer.mozilla.or
## Install
```
-$ npm install --save p-locate
+$ npm install p-locate
```
@@ -22,14 +22,16 @@ const pLocate = require('p-locate');
const files = [
'unicorn.png',
- 'rainbow.png', // only this one actually exists on disk
+ 'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
-pLocate(files, file => pathExists(file)).then(foundPath => {
+(async () => {
+ const foundPath = await pLocate(files, file => pathExists(file));
+
console.log(foundPath);
//=> 'rainbow'
-});
+})();
```
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*