1 # parse-glob [![NPM version](https://badge.fury.io/js/parse-glob.svg)](http://badge.fury.io/js/parse-glob) [![Build Status](https://travis-ci.org/jonschlinkert/parse-glob.svg)](https://travis-ci.org/jonschlinkert/parse-glob)
3 > Parse a glob pattern into an object of tokens.
5 **Changes from v1.0.0 to v3.0.4**
7 * all path-related properties are now on the `path` object
8 * all boolean properties are now on the `is` object
11 See the [properties](#properties) section for details.
13 Install with [npm](https://www.npmjs.com/)
16 $ npm i parse-glob --save
19 * parses 1,000+ glob patterns in 29ms (2.3 GHz Intel Core i7)
20 * Extensive [unit tests](./test.js) (more than 1,000 lines), covering wildcards, globstars, character classes, brace patterns, extglobs, dotfiles and other complex patterns.
22 See the tests for [hundreds of examples](./test.js).
27 var parseGlob = require('parse-glob');
33 parseGlob('a/b/c/**/*.{yml,json}');
39 { orig: 'a/b/c/**/*.{yml,json}',
49 glob: '**/*.{yml,json}',
52 { dirname: 'a/b/c/**/',
53 basename: '*.{yml,json}',
55 extname: '.{yml,json}',
61 The object returned by parseGlob has the following properties:
63 * `orig`: a copy of the original, unmodified glob pattern
64 * `is`: an object with boolean information about the glob:
65 - `glob`: true if the pattern actually a glob pattern
66 - `negated`: true if it's a negation pattern (`!**/foo.js`)
67 - `extglob`: true if it has extglobs (`@(foo|bar)`)
68 - `braces`: true if it has braces (`{1..2}` or `.{txt,md}`)
69 - `brackets`: true if it has POSIX brackets (`[[:alpha:]]`)
70 - `globstar`: true if the pattern has a globstar (double star, `**`)
71 - `dotfile`: true if the pattern should match dotfiles
72 - `dotdir`: true if the pattern should match dot-directories (like `.git`)
73 * `glob`: the glob pattern part of the string, if any
74 * `base`: the non-glob part of the string, if any
75 * `path`: file path segments
76 - `dirname`: directory
77 - `basename`: file name with extension
78 - `filename`: file name without extension
79 - `extname`: file extension with dot
80 - `ext`: file extension without dot
83 * [glob-base](https://www.npmjs.com/package/glob-base): Returns an object with the (non-glob) base path and the actual pattern. | [homepage](https://github.com/jonschlinkert/glob-base)
84 * [glob-parent](https://www.npmjs.com/package/glob-parent): Strips glob magic from a string to provide the parent path | [homepage](https://github.com/es128/glob-parent)
85 * [glob-path-regex](https://www.npmjs.com/package/glob-path-regex): Regular expression for matching the parts of glob pattern. | [homepage](https://github.com/regexps/glob-path-regex)
86 * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern. | [homepage](https://github.com/jonschlinkert/is-glob)
87 * [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)
91 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-glob/issues/new).
95 Install dev dependencies:
98 $ npm i -d && npm test
105 + [github/jonschlinkert](https://github.com/jonschlinkert)
106 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
110 Copyright © 2014-2015 Jon Schlinkert
111 Released under the MIT license.
115 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 22, 2015._