diff options
Diffstat (limited to 'node_modules/find-up')
-rw-r--r-- | node_modules/find-up/index.js | 48 | ||||
-rw-r--r-- | node_modules/find-up/license | 21 | ||||
-rw-r--r-- | node_modules/find-up/package.json | 85 | ||||
-rw-r--r-- | node_modules/find-up/readme.md | 85 |
4 files changed, 0 insertions, 239 deletions
diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js deleted file mode 100644 index 939c955..0000000 --- a/node_modules/find-up/index.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; -const path = require('path'); -const locatePath = require('locate-path'); - -module.exports = (filename, opts) => { - opts = opts || {}; - - const startDir = path.resolve(opts.cwd || ''); - const root = path.parse(startDir).root; - - const filenames = [].concat(filename); - - return new Promise(resolve => { - (function find(dir) { - locatePath(filenames, {cwd: dir}).then(file => { - if (file) { - resolve(path.join(dir, file)); - } else if (dir === root) { - resolve(null); - } else { - find(path.dirname(dir)); - } - }); - })(startDir); - }); -}; - -module.exports.sync = (filename, opts) => { - opts = opts || {}; - - let dir = path.resolve(opts.cwd || ''); - const root = path.parse(dir).root; - - const filenames = [].concat(filename); - - // eslint-disable-next-line no-constant-condition - while (true) { - const file = locatePath.sync(filenames, {cwd: dir}); - - if (file) { - return path.join(dir, file); - } else if (dir === root) { - return null; - } - - dir = path.dirname(dir); - } -}; diff --git a/node_modules/find-up/license b/node_modules/find-up/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/find-up/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -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: - -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. diff --git a/node_modules/find-up/package.json b/node_modules/find-up/package.json deleted file mode 100644 index 513eb4e..0000000 --- a/node_modules/find-up/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_from": "find-up@^2.1.0", - "_id": "find-up@2.1.0", - "_inBundle": false, - "_integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "_location": "/find-up", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "find-up@^2.1.0", - "name": "find-up", - "escapedName": "find-up", - "rawSpec": "^2.1.0", - "saveSpec": null, - "fetchSpec": "^2.1.0" - }, - "_requiredBy": [ - "/pkg-dir" - ], - "_resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "_shasum": "45d1b7e506c717ddd482775a2b77920a3c0c57a7", - "_spec": "find-up@^2.1.0", - "_where": "/home/pruss/Dev/3-minute-website/node_modules/pkg-dir", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/find-up/issues" - }, - "bundleDependencies": false, - "dependencies": { - "locate-path": "^2.0.0" - }, - "deprecated": false, - "description": "Find a file by walking up parent directories", - "devDependencies": { - "ava": "*", - "tempfile": "^1.1.1", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/find-up#readme", - "keywords": [ - "find", - "up", - "find-up", - "findup", - "look-up", - "look", - "file", - "search", - "match", - "package", - "resolve", - "parent", - "parents", - "folder", - "directory", - "dir", - "walk", - "walking", - "path" - ], - "license": "MIT", - "name": "find-up", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/find-up.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "2.1.0", - "xo": { - "esnext": true - } -} diff --git a/node_modules/find-up/readme.md b/node_modules/find-up/readme.md deleted file mode 100644 index b5ad694..0000000 --- a/node_modules/find-up/readme.md +++ /dev/null @@ -1,85 +0,0 @@ -# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master) - -> Find a file by walking up parent directories - - -## Install - -``` -$ npm install --save find-up -``` - - -## Usage - -``` -/ -└── Users - └── sindresorhus - ├── unicorn.png - └── foo - └── bar - ├── baz - └── example.js -``` - -```js -// example.js -const findUp = require('find-up'); - -findUp('unicorn.png').then(filepath => { - console.log(filepath); - //=> '/Users/sindresorhus/unicorn.png' -}); - -findUp(['rainbow.png', 'unicorn.png']).then(filepath => { - console.log(filepath); - //=> '/Users/sindresorhus/unicorn.png' -}); -``` - - -## API - -### findUp(filename, [options]) - -Returns a `Promise` for the filepath or `null`. - -### findUp([filenameA, filenameB], [options]) - -Returns a `Promise` for the first filepath found (by respecting the order) or `null`. - -### findUp.sync(filename, [options]) - -Returns a filepath or `null`. - -### findUp.sync([filenameA, filenameB], [options]) - -Returns the first filepath found (by respecting the order) or `null`. - -#### filename - -Type: `string` - -Filename of the file to find. - -#### options - -##### cwd - -Type: `string`<br> -Default: `process.cwd()` - -Directory to start from. - - -## Related - -- [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 - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) |