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/find-up/readme.md')
-rw-r--r--node_modules/find-up/readme.md24
1 files changed, 13 insertions, 11 deletions
diff --git a/node_modules/find-up/readme.md b/node_modules/find-up/readme.md
index b5ad69455..810ad7ceb 100644
--- a/node_modules/find-up/readme.md
+++ b/node_modules/find-up/readme.md
@@ -1,12 +1,12 @@
# find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
-> Find a file by walking up parent directories
+> Find a file or directory by walking up parent directories
## Install
```
-$ npm install --save find-up
+$ npm install find-up
```
@@ -23,19 +23,18 @@ $ npm install --save find-up
└── example.js
```
+`example.js`
+
```js
-// example.js
const findUp = require('find-up');
-findUp('unicorn.png').then(filepath => {
- console.log(filepath);
+(async () => {
+ console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
-});
-findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
- console.log(filepath);
+ console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
-});
+})();
```
@@ -43,11 +42,11 @@ findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
### findUp(filename, [options])
-Returns a `Promise` for the filepath or `null`.
+Returns a `Promise` for either the filepath or `null` if it couldn't be found.
### findUp([filenameA, filenameB], [options])
-Returns a `Promise` for the first filepath found (by respecting the order) or `null`.
+Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.
### findUp.sync(filename, [options])
@@ -65,6 +64,8 @@ Filename of the file to find.
#### options
+Type: `Object`
+
##### cwd
Type: `string`<br>
@@ -78,6 +79,7 @@ Directory to start from.
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
+- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
## License