@@ -4,7 +4,7 @@ Find [vfile][]s by searching the file system downwards.
4
4
5
5
## Installation
6
6
7
- [ npm] [ npm-install ] :
7
+ [ npm] [ ] :
8
8
9
9
``` bash
10
10
npm install vfile-find-down
@@ -18,41 +18,51 @@ var findDown = require('vfile-find-down');
18
18
findDown .all (' .md' , console .log );
19
19
```
20
20
21
- Logs :
21
+ Yields :
22
22
23
23
``` js
24
24
null [ VFile {
25
- data: {},
26
- messages: [],
27
- history: [ ' /Users/tilde/projects/oss/vfile-find-down/readme.md' ],
28
- cwd: ' /Users/tilde/projects/oss/vfile-find-down' } ]
25
+ data: {},
26
+ messages: [],
27
+ history: [ ' /Users/tilde/projects/oss/vfile-find-down/readme.md' ],
28
+ cwd: ' /Users/tilde/projects/oss/vfile-find-down' } ]
29
29
```
30
30
31
31
## API
32
32
33
- ### ` vfileFindDown .all(tests[, paths], callback)`
33
+ ### ` findDown .all(tests[, paths], callback)`
34
34
35
35
Search for ` tests ` downwards. Invokes callback with either an error
36
36
or an array of files passing ` tests ` .
37
37
Note: Virtual Files are not read (their ` contents ` is not populated).
38
38
39
- ###### Parameters
39
+ ##### Parameters
40
40
41
- * ` tests ` (` string|Function|Array.<tests> ` )
42
- — A test is a [ function invoked with a ` vfile ` ] [ test ] .
43
- If an array is passed in, any test must match a given file for it
44
- to be included.
45
- If a ` string ` is passed in, the ` basename ` or ` extname ` of files
46
- must match it for them to be included (and hidden directories and
47
- ` node_modules ` will not be searched).
48
- * ` paths ` (` Array.<string> ` or ` string ` , default: ` process.cwd() ` )
49
- — Place(s) to searching from;
50
- * ` callback ` (` function cb(err[, files]) ` );
51
- — Function invoked with all matching files.
41
+ ###### ` tests `
52
42
53
- ### ` vfileFindDown.one( tests[, paths], callback) `
43
+ Things to search for ( ` string|Function|Array.< tests> ` ).
54
44
55
- Like ` vfileFindDown.all ` , but invokes ` callback ` with the first found
45
+ If an array is passed in, any test must match a given file for it
46
+ to be included.
47
+
48
+ If a ` string ` is passed in, the ` basename ` or ` extname ` of files
49
+ must match it for them to be included (and hidden directories and
50
+ ` node_modules ` will not be searched).
51
+
52
+ Otherwise, they must be [ ` function ` ] [ test ] .
53
+
54
+ ###### ` paths `
55
+
56
+ Place(s) to searching from (` Array.<string> ` or ` string ` , default:
57
+ ` process.cwd() ` ).
58
+
59
+ ###### ` callback `
60
+
61
+ Function invoked with all matching files (` function cb(err[, files]) ` ).
62
+
63
+ ### ` findDown.one(tests[, paths], callback) `
64
+
65
+ Like ` findDown.all ` , but invokes ` callback ` with the first found
56
66
file, or ` null ` .
57
67
58
68
### ` function test(file, stats) `
@@ -62,17 +72,17 @@ a [vfile][] and a [stats][] object.
62
72
63
73
###### Returns
64
74
65
- * ` true ` or ` vfileFindDown .INCLUDE` — Include the file in the results;
66
- * ` vfileFindDown .SKIP` — Do not search inside this directory;
67
- * ` vfileFindDown .BREAK` — Stop searching for files;
75
+ * ` true ` or ` findDown .INCLUDE` — Include the file in the results;
76
+ * ` findDown .SKIP` — Do not search inside this directory;
77
+ * ` findDown .BREAK` — Stop searching for files;
68
78
* anything else is ignored: files are neither included nor skipped.
69
79
70
80
The different flags can be combined by using the pipe operator:
71
- ` vfileFindDown .INCLUDE | vfileFindDown .SKIP` .
81
+ ` findDown .INCLUDE | findDown .SKIP` .
72
82
73
83
## License
74
84
75
- [ MIT] [ license ] © [ Titus Wormer] [ author ]
85
+ [ MIT] [ ] © [ Titus Wormer] [ author ]
76
86
77
87
<!-- Definitions -->
78
88
@@ -84,9 +94,9 @@ The different flags can be combined by using the pipe operator:
84
94
85
95
[ codecov ] : https://codecov.io/github/vfile/vfile-find-down
86
96
87
- [ npm-install ] : https://docs.npmjs.com/cli/install
97
+ [ npm ] : https://docs.npmjs.com/cli/install
88
98
89
- [ license ] : LICENSE
99
+ [ mit ] : LICENSE
90
100
91
101
[ author ] : http://wooorm.com
92
102
0 commit comments