diff options
Diffstat (limited to 'node_modules/find-up')
-rw-r--r-- | node_modules/find-up/index.js | 16 | ||||
-rw-r--r-- | node_modules/find-up/license | 20 | ||||
-rw-r--r-- | node_modules/find-up/package.json | 39 | ||||
-rw-r--r-- | node_modules/find-up/readme.md | 24 |
4 files changed, 43 insertions, 56 deletions
diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js index 939c9553d..8e83819ce 100644 --- a/node_modules/find-up/index.js +++ b/node_modules/find-up/index.js @@ -2,11 +2,9 @@ const path = require('path'); const locatePath = require('locate-path'); -module.exports = (filename, opts) => { - opts = opts || {}; - +module.exports = (filename, opts = {}) => { const startDir = path.resolve(opts.cwd || ''); - const root = path.parse(startDir).root; + const {root} = path.parse(startDir); const filenames = [].concat(filename); @@ -25,11 +23,9 @@ module.exports = (filename, opts) => { }); }; -module.exports.sync = (filename, opts) => { - opts = opts || {}; - +module.exports.sync = (filename, opts = {}) => { let dir = path.resolve(opts.cwd || ''); - const root = path.parse(dir).root; + const {root} = path.parse(dir); const filenames = [].concat(filename); @@ -39,7 +35,9 @@ module.exports.sync = (filename, opts) => { if (file) { return path.join(dir, file); - } else if (dir === root) { + } + + if (dir === root) { return null; } diff --git a/node_modules/find-up/license b/node_modules/find-up/license index 654d0bfe9..e7af2f771 100644 --- a/node_modules/find-up/license +++ b/node_modules/find-up/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/find-up/package.json b/node_modules/find-up/package.json index 3647cbf41..9493a9924 100644 --- a/node_modules/find-up/package.json +++ b/node_modules/find-up/package.json @@ -1,29 +1,31 @@ { - "_from": "find-up@^2.1.0", - "_id": "find-up@2.1.0", + "_from": "find-up@^3.0.0", + "_id": "find-up@3.0.0", "_inBundle": false, - "_integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "_integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "_location": "/find-up", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "find-up@^2.1.0", + "raw": "find-up@^3.0.0", "name": "find-up", "escapedName": "find-up", - "rawSpec": "^2.1.0", + "rawSpec": "^3.0.0", "saveSpec": null, - "fetchSpec": "^2.1.0" + "fetchSpec": "^3.0.0" }, "_requiredBy": [ - "/pkg-conf", - "/read-pkg-up", + "/find-cache-dir/pkg-dir", + "/nyc", + "/nyc/yargs", + "/test-exclude/read-pkg-up", "/yargs" ], - "_resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "_shasum": "45d1b7e506c717ddd482775a2b77920a3c0c57a7", - "_spec": "find-up@^2.1.0", - "_where": "/Users/rebecca/code/npm/node_modules/yargs", + "_resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "_shasum": "49169f1d7993430646da61ecc5ae355c21c97b73", + "_spec": "find-up@^3.0.0", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/yargs", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -34,17 +36,17 @@ }, "bundleDependencies": false, "dependencies": { - "locate-path": "^2.0.0" + "locate-path": "^3.0.0" }, "deprecated": false, - "description": "Find a file by walking up parent directories", + "description": "Find a file or directory by walking up parent directories", "devDependencies": { "ava": "*", - "tempfile": "^1.1.1", + "tempy": "^0.2.1", "xo": "*" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ "index.js" @@ -80,8 +82,5 @@ "scripts": { "test": "xo && ava" }, - "version": "2.1.0", - "xo": { - "esnext": true - } + "version": "3.0.0" } 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 |