Initial commit
[yaffs-website] / node_modules / glob-base / README.md
1 # glob-base [![NPM version](https://badge.fury.io/js/glob-base.svg)](http://badge.fury.io/js/glob-base)  [![Build Status](https://travis-ci.org/jonschlinkert/glob-base.svg)](https://travis-ci.org/jonschlinkert/glob-base) 
2
3 > Returns an object with the (non-glob) base path and the actual pattern.
4
5 Use [glob-parent](https://github.com/es128/glob-parent) if you just want the base path.
6
7 ## Install with [npm](npmjs.org)
8
9 ```bash
10 npm i glob-base --save
11 ```
12
13 ## Related projects
14 * [glob-parent](https://github.com/es128/glob-parent): Strips glob magic from a string to provide the parent path
15 * [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.
16 * [parse-glob](https://github.com/jonschlinkert/parse-glob): Parse a glob pattern into an object of tokens.
17 * [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.
18 * [braces](https://github.com/jonschlinkert/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.
19 * [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.
20 * [expand-range](https://github.com/jonschlinkert/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See the benchmarks. Used by micromatch.
21
22 ## Usage
23
24 ```js
25 var globBase = require('glob-base');
26
27 globBase('a/b/.git/');
28 //=> { base: 'a/b/.git/', isGlob: false, glob: '' })
29
30 globBase('a/b/**/e');
31 //=> { base: 'a/b', isGlob: true, glob: '**/e' }
32
33 globBase('a/b/*.{foo,bar}');
34 //=> { base: 'a/b', isGlob: true, glob: '*.{foo,bar}' }
35
36 globBase('a/b/.git/**');
37 //=> { base: 'a/b/.git', isGlob: true, glob: '**' }
38
39 globBase('a/b/c/*.md');
40 //=> { base: 'a/b/c', isGlob: true, glob: '*.md' }
41
42 globBase('a/b/c/.*.md');
43 //=> { base: 'a/b/c', isGlob: true, glob: '.*.md' }
44
45 globBase('a/b/{c,d}');
46 //=> { base: 'a/b', isGlob: true, glob: '{c,d}' }
47
48 globBase('!*.min.js');
49 //=> { base: '.', isGlob: true, glob: '!*.min.js' }
50
51 globBase('!foo');
52 //=> { base: '.', isGlob: true, glob: '!foo' }
53
54 globBase('!foo/(a|b).min.js');
55 //=> { base: '.', isGlob: true, glob: '!foo/(a|b).min.js' }
56
57 globBase('');
58 //=> { base: '.', isGlob: false, glob: '' }
59
60 globBase('**/*.md');
61 //=> { base: '.', isGlob: true, glob: '**/*.md' }
62
63 globBase('**/*.min.js');
64 //=> { base: '.', isGlob: true, glob: '**/*.min.js' }
65
66 globBase('**/.*');
67 //=> { base: '.', isGlob: true, glob: '**/.*' }
68
69 globBase('**/d');
70 //=> { base: '.', isGlob: true, glob: '**/d' }
71
72 globBase('*.*');
73 //=> { base: '.', isGlob: true, glob: '*.*' }
74
75 globBase('*.min.js');
76 //=> { base: '.', isGlob: true, glob: '*.min.js' }
77
78 globBase('*/*');
79 //=> { base: '.', isGlob: true, glob: '*/*' }
80
81 globBase('*b');
82 //=> { base: '.', isGlob: true, glob: '*b' }
83
84 globBase('.');
85 //=> { base: '.', isGlob: false, glob: '.' }
86
87 globBase('.*');
88 //=> { base: '.', isGlob: true, glob: '.*' }
89
90 globBase('./*');
91 //=> { base: '.', isGlob: true, glob: '*' }
92
93 globBase('/a');
94 //=> { base: '/', isGlob: false, glob: 'a' }
95
96 globBase('@(a|b)/e.f.g/');
97 //=> { base: '.', isGlob: true, glob: '@(a|b)/e.f.g/' }
98
99 globBase('[a-c]b*');
100 //=> { base: '.', isGlob: true, glob: '[a-c]b*' }
101
102 globBase('a');
103 //=> { base: '.', isGlob: false, glob: 'a' }
104
105 globBase('a.min.js');
106 //=> { base: '.', isGlob: false, glob: 'a.min.js' }
107
108 globBase('a/');
109 //=> { base: 'a/', isGlob: false, glob: '' }
110
111 globBase('a/**/j/**/z/*.md');
112 //=> { base: 'a', isGlob: true, glob: '**/j/**/z/*.md' }
113
114 globBase('a/*/c/*.md');
115 //=> { base: 'a', isGlob: true, glob: '*/c/*.md' }
116
117 globBase('a/?/c.md');
118 //=> { base: 'a', isGlob: true, glob: '?/c.md' }
119
120 globBase('a/??/c.js');
121 //=> { base: 'a', isGlob: true, glob: '??/c.js' }
122
123 globBase('a?b');
124 //=> { base: '.', isGlob: true, glob: 'a?b' }
125
126 globBase('bb');
127 //=> { base: '.', isGlob: false, glob: 'bb' }
128
129 globBase('c.md');
130 //=> { base: '.', isGlob: false, glob: 'c.md' }
131 ```
132
133 ## Running tests
134 Install dev dependencies.
135
136 ```bash
137 npm i -d && npm test
138 ```
139
140
141 ## Contributing
142 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/glob-base/issues)
143
144
145 ## Author
146
147 **Jon Schlinkert**
148  
149 + [github/jonschlinkert](https://github.com/jonschlinkert)
150 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 
151
152 ## License
153 Copyright (c) 2015 Jon Schlinkert  
154 Released under the MIT license
155
156 ***
157
158 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 08, 2015._