Skip to content

Commit

Permalink
#77: more instructions for .checkIgnore()
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Dec 18, 2024
1 parent 8d9c3e5 commit d88109f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ Returns `Boolean` whether `pathname` should be ignored.
ig.ignores('.abc/a.js') // true
```

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.
Please **PAY ATTENTION** that `.ignores()` is **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 `.checkIgnore()` instead.

### `Pathname` Conventions:

Expand Down Expand Up @@ -285,6 +287,16 @@ interface TestResult {
- `{ignored: false, unignored: true}`: the `pathname` is unignored
- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.

## .checkIgnore(pattern) since 6.1.0

> new in 6.1.0
Please pay attention that this method does not have a strong built-in cache mechanism.

The purpose of introducing this method is to make it possible to implement the `git check-ignore` command in JavaScript based on `node-ignore`.

So do not use this method in those situations where performance is extremely important.

## static `isPathValid(pathname): boolean` since 5.0.0

Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).
Expand Down

0 comments on commit d88109f

Please sign in to comment.