Initial commit
[yaffs-website] / node_modules / parse-glob / README.md
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)
2
3 > Parse a glob pattern into an object of tokens.
4
5 **Changes from v1.0.0 to v3.0.4**
6
7 * all path-related properties are now on the `path` object
8 * all boolean properties are now on the `is` object
9 * adds `base` property
10
11 See the [properties](#properties) section for details.
12
13 Install with [npm](https://www.npmjs.com/)
14
15 ```sh
16 $ npm i parse-glob --save
17 ```
18
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.
21
22 See the tests for [hundreds of examples](./test.js).
23
24 ## Usage
25
26 ```js
27 var parseGlob = require('parse-glob');
28 ```
29
30 **Example**
31
32 ```js
33 parseGlob('a/b/c/**/*.{yml,json}');
34 ```
35
36 **Returns:**
37
38 ```js
39 { orig: 'a/b/c/**/*.{yml,json}',
40   is:
41    { glob: true,
42      negated: false,
43      extglob: false,
44      braces: true,
45      brackets: false,
46      globstar: true,
47      dotfile: false,
48      dotdir: false },
49   glob: '**/*.{yml,json}',
50   base: 'a/b/c',
51   path:
52    { dirname: 'a/b/c/**/',
53      basename: '*.{yml,json}',
54      filename: '*',
55      extname: '.{yml,json}',
56      ext: '{yml,json}' } }
57 ```
58
59 ## Properties
60
61 The object returned by parseGlob has the following properties:
62
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
81
82 ## Related
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)
88
89 ## Contributing
90
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).
92
93 ## Tests
94
95 Install dev dependencies:
96
97 ```sh
98 $ npm i -d && npm test
99 ```
100
101 ## Author
102
103 **Jon Schlinkert**
104
105 + [github/jonschlinkert](https://github.com/jonschlinkert)
106 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
107
108 ## License
109
110 Copyright © 2014-2015 Jon Schlinkert
111 Released under the MIT license.
112
113 ***
114
115 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 22, 2015._