vfile-find-up
Advanced tools
Comparing version 4.0.0 to 4.0.1
27
index.js
@@ -20,3 +20,3 @@ 'use strict' | ||
/* Find a file or a directory upwards. */ | ||
// Find a file or a directory upwards. | ||
function findOne(test, cwd, callback) { | ||
@@ -26,3 +26,3 @@ return find(test, cwd, callback, true) | ||
/* Find files or directories upwards. */ | ||
// Find files or directories upwards. | ||
function findAll(test, cwd, callback) { | ||
@@ -32,3 +32,3 @@ return find(test, cwd, callback) | ||
/* Find applicable files. */ | ||
// Find applicable files. | ||
function find(test, cwd, callback, one) { | ||
@@ -49,4 +49,3 @@ var results = [] | ||
/* Test a file and check what should be done with | ||
* the resulting file. */ | ||
// Test a file and check what should be done with the resulting file. | ||
function handle(filePath) { | ||
@@ -71,3 +70,3 @@ var file = toVFile(filePath) | ||
/* Check one directory. */ | ||
// Check one directory. | ||
function once(child) { | ||
@@ -110,3 +109,3 @@ if (handle(current) === true) { | ||
/* Augment `test` */ | ||
// Augment `test` | ||
function augment(test) { | ||
@@ -120,3 +119,3 @@ if (typeof test === 'function') { | ||
/* Check multiple tests. */ | ||
// Check multiple tests. | ||
function multiple(test) { | ||
@@ -150,7 +149,7 @@ var length = test.length | ||
/* Wrap a string given as a test. | ||
* | ||
* A normal string checks for equality to both the filename | ||
* and extension. A string starting with a `.` checks for | ||
* that equality too, and also to just the extension. */ | ||
// Wrap a string given as a test. | ||
// | ||
// A normal string checks for equality to both the filename and extension. | ||
// A string starting with a `.` checks for that equality too, and also to just | ||
// the extension. | ||
function testString(test) { | ||
@@ -164,5 +163,5 @@ return check | ||
/* Check a mask. */ | ||
// Check a mask. | ||
function mask(value, bitmask) { | ||
return (value & bitmask) === bitmask | ||
} |
{ | ||
"name": "vfile-find-up", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Find files by searching the file system upwards", | ||
@@ -26,11 +26,11 @@ "license": "MIT", | ||
"devDependencies": { | ||
"nyc": "^13.0.0", | ||
"prettier": "^1.12.1", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.0.0", | ||
"remark-cli": "^6.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"remark-preset-wooorm": "^5.0.0", | ||
"tape": "^4.0.0", | ||
"xo": "^0.23.0" | ||
"xo": "^0.24.0" | ||
}, | ||
"scripts": { | ||
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", | ||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
"test-api": "node test", | ||
@@ -56,8 +56,3 @@ "test-coverage": "nyc --reporter lcov tape test/index.js", | ||
"prettier": true, | ||
"esnext": false, | ||
"rules": { | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off", | ||
"object-shorthand": "off" | ||
} | ||
"esnext": false | ||
}, | ||
@@ -64,0 +59,0 @@ "remarkConfig": { |
@@ -1,10 +0,17 @@ | ||
# vfile-find-up [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
# vfile-find-up | ||
[![Build][build-badge]][build] | ||
[![Coverage][coverage-badge]][coverage] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Sponsors][sponsors-badge]][collective] | ||
[![Backers][backers-badge]][collective] | ||
[![Chat][chat-badge]][chat] | ||
Find [vfile][]s by searching the file system upwards. | ||
## Installation | ||
## Install | ||
[npm][]: | ||
```bash | ||
```sh | ||
npm install vfile-find-up | ||
@@ -35,4 +42,4 @@ ``` | ||
Search for `tests` upwards. Invokes callback with either an error | ||
or an array of files passing `tests`. | ||
Search for `tests` upwards. | ||
Invokes callback with either an error or an array of files passing `tests`. | ||
Note: Virtual Files are not read (their `contents` is not populated). | ||
@@ -44,9 +51,9 @@ | ||
Things to search for (`string|Function|Array.<tests>`). | ||
Things to search for (`string`, `Function`, or `Array.<tests>`). | ||
If a `string` is passed in, the `basename` or `extname` of files | ||
must match it for them to be included. | ||
If a `string` is passed in, the `basename` or `extname` of files must match it | ||
for them to be included. | ||
If an array is passed in, any test must match a given file for it | ||
to be included. | ||
If an array is passed in, any test must match a given file for it to be | ||
included. | ||
@@ -65,15 +72,14 @@ Otherwise, they must be [`function`][test]. | ||
Like `findUp.all`, but invokes `callback` with the first found | ||
file, or `null`. | ||
Like `findUp.all`, but invokes `callback` with the first found file, or `null`. | ||
### `function test(file)` | ||
Check whether a virtual file should be included. Invoked with a | ||
[vfile][]. | ||
Check whether a virtual file should be included. | ||
Invoked with a [vfile][]. | ||
##### Returns | ||
* `true` or `findUp.INCLUDE` — Include the file in the results; | ||
* `findUp.BREAK` — Stop searching for files; | ||
* anything else is ignored: the file is not included. | ||
* `true` or `findUp.INCLUDE` — Include the file in the results | ||
* `findUp.BREAK` — Stop searching for files | ||
* anything else is ignored: the file is not included | ||
@@ -85,25 +91,50 @@ The different flags can be combined by using the pipe operator: | ||
See [`contributing.md` in `vfile/vfile`][contributing] for ways to get started. | ||
See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to | ||
get started. | ||
See [`support.md`][support] for ways to get help. | ||
This organisation has a [Code of Conduct][coc]. By interacting with this | ||
repository, organisation, or community you agree to abide by its terms. | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
abide by its terms. | ||
## License | ||
[MIT][] © [Titus Wormer][author] | ||
[MIT][license] © [Titus Wormer][author] | ||
<!-- Definitions --> | ||
[travis-badge]: https://img.shields.io/travis/vfile/vfile-find-up.svg | ||
[build-badge]: https://img.shields.io/travis/vfile/vfile-find-up.svg | ||
[travis]: https://travis-ci.org/vfile/vfile-find-up | ||
[build]: https://travis-ci.org/vfile/vfile-find-up | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-find-up.svg | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-find-up.svg | ||
[codecov]: https://codecov.io/github/vfile/vfile-find-up | ||
[coverage]: https://codecov.io/github/vfile/vfile-find-up | ||
[downloads-badge]: https://img.shields.io/npm/dm/vfile-find-up.svg | ||
[downloads]: https://www.npmjs.com/package/vfile-find-up | ||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg | ||
[collective]: https://opencollective.com/unified | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat]: https://spectrum.chat/unified/vfile | ||
[npm]: https://docs.npmjs.com/cli/install | ||
[mit]: license | ||
[contributing]: https://github.com/vfile/.github/blob/master/contributing.md | ||
[support]: https://github.com/vfile/.github/blob/master/support.md | ||
[health]: https://github.com/vfile/.github | ||
[coc]: https://github.com/vfile/.github/blob/master/code-of-conduct.md | ||
[license]: license | ||
[author]: https://wooorm.com | ||
@@ -114,5 +145,1 @@ | ||
[test]: #function-testfile | ||
[contributing]: https://github.com/vfile/vfile/blob/master/contributing.md | ||
[coc]: https://github.com/vfile/vfile/blob/master/code-of-conduct.md |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8801
141
121