This repository has been archived on 2021-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
parse-glob/README.md
2015-02-07 16:18:57 -05:00

63 lines
1.3 KiB
Markdown

# parse-glob [![NPM version](https://badge.fury.io/js/parse-glob.svg)](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 or dot directories (e.g. './.git/')
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._