vfile-find-down
Advanced tools
Comparing version 4.0.0 to 4.0.1
31
index.js
'use strict' | ||
/* eslint-disable handle-callback-err, max-params */ | ||
var fs = require('fs') | ||
@@ -25,3 +23,3 @@ var path = require('path') | ||
/* Find a file or a directory downwards. */ | ||
// Find a file or a directory downwards. | ||
function one(test, paths, callback) { | ||
@@ -31,3 +29,3 @@ return find(test, paths, callback, true) | ||
/* Find files or directories downwards. */ | ||
// Find files or directories downwards. | ||
function all(test, paths, callback) { | ||
@@ -37,3 +35,3 @@ return find(test, paths, callback) | ||
/* Find applicable files. */ | ||
// Find applicable files. | ||
function find(test, paths, callback, one) { | ||
@@ -60,7 +58,7 @@ var state = { | ||
/* Find files in `filePath`. */ | ||
// Find files in `filePath`. | ||
function visit(state, filePath, one, done) { | ||
var file | ||
/* Don’t walk into places multiple times. */ | ||
// Don’t walk into places multiple times. | ||
if (own.call(state.checked, filePath)) { | ||
@@ -117,4 +115,4 @@ done([]) | ||
/* Find files in `paths`. Returns a list of | ||
* applicable files. */ | ||
// Find files in `paths`. Returns a list of applicable files. | ||
// eslint-disable-next-line max-params | ||
function visitAll(state, paths, cwd, one, done) { | ||
@@ -147,4 +145,4 @@ var expected = paths.length | ||
/* Augment `test` from several supported values to a | ||
* function returning a boolean. */ | ||
// Augment `test` from several supported values to a function returning a | ||
// boolean. | ||
function augment(test) { | ||
@@ -158,11 +156,10 @@ if (typeof test === 'function') { | ||
/* 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) { | ||
return check | ||
/* Check whether the given `file` matches the bound | ||
* value. */ | ||
// Check whether the given `file` matches the bound value. | ||
function check(file) { | ||
@@ -169,0 +166,0 @@ var basename = file.basename |
{ | ||
"name": "vfile-find-down", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Find files by searching the file system downwards", | ||
@@ -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-down [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
# vfile-find-down | ||
[![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 downwards. | ||
## Installation | ||
## Install | ||
[npm][]: | ||
```bash | ||
```sh | ||
npm install vfile-find-down | ||
@@ -35,4 +42,4 @@ ``` | ||
Search for `tests` downwards. Invokes callback with either an error | ||
or an array of files passing `tests`. | ||
Search for `tests` downwards. | ||
Invokes callback with either an error or an array of files passing `tests`. | ||
Note: Virtual Files are not read (their `contents` is not populated). | ||
@@ -46,8 +53,8 @@ | ||
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. | ||
If a `string` is passed in, the `basename` or `extname` of files | ||
must match it for them to be included (and hidden directories and | ||
`node_modules` will not be searched). | ||
If a `string` is passed in, the `basename` or `extname` of files must match it | ||
for them to be included (and hidden directories and `node_modules` will not be | ||
searched). | ||
@@ -67,16 +74,16 @@ Otherwise, they must be [`function`][test]. | ||
Like `findDown.all`, but invokes `callback` with the first found | ||
file, or `null`. | ||
Like `findDown.all`, but invokes `callback` with the first found file, or | ||
`null`. | ||
### `function test(file, stats)` | ||
Check whether a virtual file should be included. Invoked with | ||
a [vfile][] and a [stats][] object. | ||
Check whether a virtual file should be included. | ||
Invoked with a [vfile][] and a [stats][] object. | ||
###### Returns | ||
* `true` or `findDown.INCLUDE` — Include the file in the results; | ||
* `findDown.SKIP` — Do not search inside this directory; | ||
* `findDown.BREAK` — Stop searching for files; | ||
* anything else is ignored: files are neither included nor skipped. | ||
* `true` or `findDown.INCLUDE` — Include the file in the results | ||
* `findDown.SKIP` — Do not search inside this directory | ||
* `findDown.BREAK` — Stop searching for files | ||
* anything else is ignored: files are neither included nor skipped | ||
@@ -88,25 +95,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-down.svg | ||
[build-badge]: https://img.shields.io/travis/vfile/vfile-find-down.svg | ||
[travis]: https://travis-ci.org/vfile/vfile-find-down | ||
[build]: https://travis-ci.org/vfile/vfile-find-down | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-find-down.svg | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-find-down.svg | ||
[codecov]: https://codecov.io/github/vfile/vfile-find-down | ||
[coverage]: https://codecov.io/github/vfile/vfile-find-down | ||
[downloads-badge]: https://img.shields.io/npm/dm/vfile-find-down.svg | ||
[downloads]: https://www.npmjs.com/package/vfile-find-down | ||
[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 | ||
@@ -119,5 +151,1 @@ | ||
[test]: #function-testfile-stats | ||
[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
10033
147
155