-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#77: adds more instructions for .check_ignore()
- Loading branch information
Showing
2 changed files
with
28 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,31 +149,17 @@ ignore() | |
|
||
`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance. | ||
|
||
## <strike>.addIgnoreFile(path)</strike> | ||
## .ignores(pathname: [Pathname](#pathname-conventions)): boolean | ||
|
||
REMOVED in `3.x` for now. | ||
> new in 3.2.0 | ||
To upgrade `[email protected]` up to `3.x`, use | ||
Returns `Boolean` whether `pathname` should be ignored. | ||
|
||
```js | ||
import fs from 'fs' | ||
|
||
if (fs.existsSync(filename)) { | ||
ignore().add(fs.readFileSync(filename).toString()) | ||
} | ||
``` | ||
|
||
instead. | ||
|
||
## .filter(paths: Array<Pathname>): Array<Pathname> | ||
|
||
```ts | ||
type Pathname = string | ||
ig.ignores('.abc/a.js') // true | ||
``` | ||
|
||
Filters the given array of pathnames, and returns the filtered array. | ||
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered. | ||
Please **PAY ATTENTION** that `.ignores()` does not equivalent to `git check-ignore` although in most cases they return equivalent results. However, for the purposes of imitating the behavior of `git check-ignore`, please use `.check_ignore()` instead. | ||
|
||
### `Pathname` Conventions: | ||
|
||
|
@@ -266,16 +252,17 @@ glob('**', { | |
}) | ||
``` | ||
|
||
## .ignores(pathname: Pathname): boolean | ||
|
||
> new in 3.2.0 | ||
Returns `Boolean` whether `pathname` should be ignored. | ||
## .filter(paths: Array<Pathname>): Array<Pathname> | ||
|
||
```js | ||
ig.ignores('.abc/a.js') // true | ||
```ts | ||
type Pathname = string | ||
``` | ||
Filters the given array of pathnames, and returns the filtered array. | ||
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered. | ||
## .createFilter() | ||
Creates a filter function which could filter an array of paths with `Array.prototype.filter`. | ||
|
@@ -310,6 +297,22 @@ import {isPathValid} from 'ignore' | |
isPathValid('./foo') // false | ||
``` | ||
|
||
## <strike>.addIgnoreFile(path)</strike> | ||
|
||
REMOVED in `3.x` for now. | ||
|
||
To upgrade `[email protected]` up to `3.x`, use | ||
|
||
```js | ||
import fs from 'fs' | ||
|
||
if (fs.existsSync(filename)) { | ||
ignore().add(fs.readFileSync(filename).toString()) | ||
} | ||
``` | ||
|
||
instead. | ||
|
||
## ignore(options) | ||
|
||
### `options.ignorecase` since 4.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters