63 lines
1.3 KiB
Markdown
63 lines
1.3 KiB
Markdown
# parse-glob [](http://badge.fury.io/js/parse-glob)
|
|
|
|
> Parse a glob pattern into an object of path parts.
|
|
|
|
## Install with [npm](npmjs.org)
|
|
|
|
```bash
|
|
npm i parse-glob --save
|
|
```
|
|
|
|
## Usage
|
|
|
|
```js
|
|
var parse = require('parse-glob');
|
|
|
|
// this is a nonsensical pattern, but it shows what this lib does
|
|
parse('a/b/{c,.gitignore,{a,b}}/{a,b}/*.foo.js');
|
|
```
|
|
|
|
Returns:
|
|
|
|
```js
|
|
{ pattern: 'a/b/{c,.gitignore,{a,b}}/{a,b}/*.foo.js',
|
|
dirname: 'a/b/{c,.gitignore,{a,b}}/{a,b}/',
|
|
filename: '*.foo.js',
|
|
basename: '*',
|
|
extname: '.foo.js',
|
|
ext: 'js',
|
|
|
|
// detects when a glob pattern intentionally
|
|
// specifies dotfiles
|
|
dotfiles: false,
|
|
dotdirs: false }
|
|
```
|
|
|
|
See the tests for [hundreds of examples](./test.js).
|
|
|
|
## Run tests
|
|
|
|
Install dev dependencies:
|
|
|
|
```bash
|
|
npm i -d && npm test
|
|
```
|
|
|
|
## Contributing
|
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-glob/issues)
|
|
|
|
## Author
|
|
|
|
**Jon Schlinkert**
|
|
|
|
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
|
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
|
|
|
## License
|
|
Copyright (c) 2015 Jon Schlinkert
|
|
Released under the MIT license
|
|
|
|
***
|
|
|
|
_This file was generated by [verb](https://github.com/assemble/verb) on February 07, 2015._
|