保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
PAMapp/node_modules/ignore/README.md
@@ -298,7 +298,19 @@
- `{ignored: false, unignored: true}`: the `pathname` is unignored
- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.
## `options.ignorecase` since 4.0.0
## static `ignore.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).
This method is **NOT** used to check if an ignore pattern is valid.
```js
ignore.isPathValid('./foo')  // false
```
## ignore(options)
### `options.ignorecase` since 4.0.0
Similar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive.
@@ -312,14 +324,20 @@
ig.ignores('*.PNG')  // false
```
## static `ignore.isPathValid(pathname): boolean` since 5.0.0
### `options.ignoreCase?: boolean` since 5.2.0
Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).
Which is alternative to `options.ignoreCase`
This method is **NOT** used to check if an ignore pattern is valid.
### `options.allowRelativePaths?: boolean` since 5.2.0
This option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions).
However, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior
```js
ignore.isPathValid('./foo')  // false
ignore({
  allowRelativePaths: true
}).ignores('../foo/bar.js') // And it will not throw
```
****
@@ -328,7 +346,9 @@
## Upgrade 4.x -> 5.x
Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, while `ignore < 5.0.0` did not make sure what the return value was, as well as
Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.
While `ignore < 5.0.0` did not make sure what the return value was, as well as
```ts
.ignores(pathname: Pathname): boolean