49 lines
2.1 KiB
Markdown
49 lines
2.1 KiB
Markdown
[](https://www.npmjs.com/package/glob-escape)
|
|
[](https://travis-ci.org/svenschoenung/glob-escape)
|
|
[](https://coveralls.io/github/svenschoenung/glob-escape?branch=master)
|
|
[](https://david-dm.org/svenschoenung/glob-escape)
|
|
[](https://david-dm.org/svenschoenung/glob-escape#info=devDependencies)
|
|
[](https://codeclimate.com/github/svenschoenung/glob-escape)
|
|
[](https://www.codacy.com/app/svenschoenung/glob-escape)
|
|
|
|
# glob-escape
|
|
|
|
Escapes glob patterns. Works for packages like [`minimatch`](https://www.npmjs.com/package/minimatch), [`multimatch`](https://www.npmjs.com/package/multimatch), [`glob`](https://www.npmjs.com/package/glob), [`glob-stream`](https://www.npmjs.com/package/glob-stream), [`globby`](https://www.npmjs.com/package/globby), [`vinyl-fs`](https://www.npmjs.com/package/vinyl-fs) and [`gulp`](https://www.npmjs.com/package/gulp`).
|
|
|
|
## Installation
|
|
|
|
npm install glob-escape
|
|
|
|
## Usage
|
|
|
|
```js
|
|
var escapeGlob = require('glob-escape');
|
|
var glob = require('glob');
|
|
|
|
glob('algorithms/a*.txt', function(err, array) {
|
|
// array might contain several files like:
|
|
// - algorithms/a*.txt
|
|
// - algorithms/alpha-beta_pruning.txt
|
|
// - algorithms/augmented_lagrangian_method.txt
|
|
});
|
|
|
|
glob(escapeGlob('algorithms/a*.txt'), function(err, array) {
|
|
// array will only contain one file:
|
|
// - algorithms/a*.txt
|
|
});
|
|
```
|
|
|
|
## API
|
|
|
|
### escapeGlob(glob)
|
|
|
|
Escapes all glob patterns in the provided `glob`.
|
|
|
|
`glob` may be a string or an array of strings.
|
|
|
|
Returns the escaped glob.
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE)
|