Skip to content

Commit 7d2d1b8

Browse files
committed
Refactor readme.md
1 parent c0eab46 commit 7d2d1b8

File tree

1 file changed

+38
-28
lines changed

1 file changed

+38
-28
lines changed

readme.md

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Find [vfile][]s by searching the file system downwards.
44

55
## Installation
66

7-
[npm][npm-install]:
7+
[npm][]:
88

99
```bash
1010
npm install vfile-find-down
@@ -18,41 +18,51 @@ var findDown = require('vfile-find-down');
1818
findDown.all('.md', console.log);
1919
```
2020

21-
Logs:
21+
Yields:
2222

2323
```js
2424
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' } ]
2929
```
3030

3131
## API
3232

33-
### `vfileFindDown.all(tests[, paths], callback)`
33+
### `findDown.all(tests[, paths], callback)`
3434

3535
Search for `tests` downwards. Invokes callback with either an error
3636
or an array of files passing `tests`.
3737
Note: Virtual Files are not read (their `contents` is not populated).
3838

39-
###### Parameters
39+
##### Parameters
4040

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`
5242

53-
### `vfileFindDown.one(tests[, paths], callback)`
43+
Things to search for (`string|Function|Array.<tests>`).
5444

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
5666
file, or `null`.
5767

5868
### `function test(file, stats)`
@@ -62,17 +72,17 @@ a [vfile][] and a [stats][] object.
6272

6373
###### Returns
6474

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;
6878
* anything else is ignored: files are neither included nor skipped.
6979

7080
The different flags can be combined by using the pipe operator:
71-
`vfileFindDown.INCLUDE | vfileFindDown.SKIP`.
81+
`findDown.INCLUDE | findDown.SKIP`.
7282

7383
## License
7484

75-
[MIT][license] © [Titus Wormer][author]
85+
[MIT][] © [Titus Wormer][author]
7686

7787
<!-- Definitions -->
7888

@@ -84,9 +94,9 @@ The different flags can be combined by using the pipe operator:
8494

8595
[codecov]: https://codecov.io/github/vfile/vfile-find-down
8696

87-
[npm-install]: https://docs.npmjs.com/cli/install
97+
[npm]: https://docs.npmjs.com/cli/install
8898

89-
[license]: LICENSE
99+
[mit]: LICENSE
90100

91101
[author]: http://wooorm.com
92102

0 commit comments

Comments
 (0)