zeptomatch-escape
Version:
A little utility for escaping globs before passing them to zeptomatch.
33 lines (20 loc) • 631 B
Markdown
A little utility for escaping globs before passing them to [`zeptomatch`](https://github.com/fabiospampinato/zeptomatch).
```sh
npm install zeptomatch-escape
```
```ts
import zeptomatch from 'zeptomatch';
import escape from 'zeptomatch-escape';
// Escaping special characters from a string
escape ( '*.js' ); // => '\\*.js'
// Example usage
zeptomatch ( '*.js', 'a.js' ) ); // => true
zeptomatch ( '*.js', '*.js' ) ); // => true
zeptomatch ( escape ( '*.js' ), 'a.js' ) ); // => false
zeptomatch ( escape ( '*.js' ), '*.js' ) ); // => true
```
MIT © Fabio Spampinato