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)
3 > Returns an object with the (non-glob) base path and the actual pattern.
5 Use [glob-parent](https://github.com/es128/glob-parent) if you just want the base path.
7 ## Install with [npm](npmjs.org)
10 npm i glob-base --save
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.
25 var globBase = require('glob-base');
27 globBase('a/b/.git/');
28 //=> { base: 'a/b/.git/', isGlob: false, glob: '' })
31 //=> { base: 'a/b', isGlob: true, glob: '**/e' }
33 globBase('a/b/*.{foo,bar}');
34 //=> { base: 'a/b', isGlob: true, glob: '*.{foo,bar}' }
36 globBase('a/b/.git/**');
37 //=> { base: 'a/b/.git', isGlob: true, glob: '**' }
39 globBase('a/b/c/*.md');
40 //=> { base: 'a/b/c', isGlob: true, glob: '*.md' }
42 globBase('a/b/c/.*.md');
43 //=> { base: 'a/b/c', isGlob: true, glob: '.*.md' }
45 globBase('a/b/{c,d}');
46 //=> { base: 'a/b', isGlob: true, glob: '{c,d}' }
48 globBase('!*.min.js');
49 //=> { base: '.', isGlob: true, glob: '!*.min.js' }
52 //=> { base: '.', isGlob: true, glob: '!foo' }
54 globBase('!foo/(a|b).min.js');
55 //=> { base: '.', isGlob: true, glob: '!foo/(a|b).min.js' }
58 //=> { base: '.', isGlob: false, glob: '' }
61 //=> { base: '.', isGlob: true, glob: '**/*.md' }
63 globBase('**/*.min.js');
64 //=> { base: '.', isGlob: true, glob: '**/*.min.js' }
67 //=> { base: '.', isGlob: true, glob: '**/.*' }
70 //=> { base: '.', isGlob: true, glob: '**/d' }
73 //=> { base: '.', isGlob: true, glob: '*.*' }
76 //=> { base: '.', isGlob: true, glob: '*.min.js' }
79 //=> { base: '.', isGlob: true, glob: '*/*' }
82 //=> { base: '.', isGlob: true, glob: '*b' }
85 //=> { base: '.', isGlob: false, glob: '.' }
88 //=> { base: '.', isGlob: true, glob: '.*' }
91 //=> { base: '.', isGlob: true, glob: '*' }
94 //=> { base: '/', isGlob: false, glob: 'a' }
96 globBase('@(a|b)/e.f.g/');
97 //=> { base: '.', isGlob: true, glob: '@(a|b)/e.f.g/' }
100 //=> { base: '.', isGlob: true, glob: '[a-c]b*' }
103 //=> { base: '.', isGlob: false, glob: 'a' }
105 globBase('a.min.js');
106 //=> { base: '.', isGlob: false, glob: 'a.min.js' }
109 //=> { base: 'a/', isGlob: false, glob: '' }
111 globBase('a/**/j/**/z/*.md');
112 //=> { base: 'a', isGlob: true, glob: '**/j/**/z/*.md' }
114 globBase('a/*/c/*.md');
115 //=> { base: 'a', isGlob: true, glob: '*/c/*.md' }
117 globBase('a/?/c.md');
118 //=> { base: 'a', isGlob: true, glob: '?/c.md' }
120 globBase('a/??/c.js');
121 //=> { base: 'a', isGlob: true, glob: '??/c.js' }
124 //=> { base: '.', isGlob: true, glob: 'a?b' }
127 //=> { base: '.', isGlob: false, glob: 'bb' }
130 //=> { base: '.', isGlob: false, glob: 'c.md' }
134 Install dev dependencies.
142 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/glob-base/issues)
149 + [github/jonschlinkert](https://github.com/jonschlinkert)
150 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
153 Copyright (c) 2015 Jon Schlinkert
154 Released under the MIT license
158 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 08, 2015._