# has-glob [![NPM version](https://badge.fury.io/js/has-glob.svg)](http://badge.fury.io/js/has-glob) > Returns `true` if an array has a glob pattern. Also get [is-glob](https://www.npmjs.com/package/is-glob) for checking strings for glob patterns. ## Install Install with [npm](https://www.npmjs.com/) ```sh $ npm i has-glob --save ``` ## Usage ```js var hasGlob = require('has-glob'); hasGlob(['foo', 'bar', '*.js']); //=> true hasGlob(['foo', 'bar', 'baz']); //=> false ``` **True** The following all return `true`: ```js hasGlob(['foo', 'bar', '*.js']) hasGlob(['foo', 'bar', '!*.js']) hasGlob(['foo', 'bar', '!foo']) hasGlob(['foo', 'bar', '!foo.js']) hasGlob(['foo', 'bar', '**/abc.js']) hasGlob(['foo', 'bar', 'abc/*.js']) hasGlob(['foo', 'bar', 'abc/{a,b}.js']) hasGlob(['foo', 'bar', 'abc/{a..z}.js']) hasGlob(['foo', 'bar', 'abc/{a..z..2}.js']) hasGlob(['foo', 'bar', 'abc/@(a).js']) hasGlob(['foo', 'bar', 'abc/!(a).js']) hasGlob(['foo', 'bar', 'abc/+(a).js']) hasGlob(['foo', 'bar', 'abc/*(a).js']) hasGlob(['foo', 'bar', 'abc/?(a).js']) hasGlob(['foo', 'bar', 'abc/@.js']) hasGlob(['foo', 'bar', 'abc/!.js']) hasGlob(['foo', 'bar', 'abc/+.js']) hasGlob(['foo', 'bar', 'abc/*.js']) hasGlob(['foo', 'bar', 'abc/?.js']) hasGlob(['foo', 'bar', 'abc/(aaa|bbb).js']) hasGlob(['foo', 'bar', 'abc/?.js']) hasGlob(['foo', 'bar', '?.js']) hasGlob(['foo', 'bar', '[abc].js']) hasGlob(['foo', 'bar', '[^abc].js']) hasGlob(['foo', 'bar', 'a/b/c/[a-z].js']) hasGlob(['foo', 'bar', '[a-j]*[^c]b/c']) //=> true ``` Also works with strings: ```js hasGlob('*.js') hasGlob('!*.js') hasGlob('!foo') hasGlob('!foo.js') hasGlob('**/abc.js') hasGlob('abc/*.js') //=> true ``` **False** The following all return `false`: ```js hasGlob([]) hasGlob([null]) hasGlob([undefined]) hasGlob([{}]) hasGlob(['.']) hasGlob(['foo', 'bar', 'aa']) hasGlob(['foo', 'bar', 'abc.js']) hasGlob(['foo', 'bar', 'abc/def/ghi.js']) //=> false ``` ## Related projects * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob) * [is-valid-glob](https://www.npmjs.com/package/is-valid-glob): Return true if a value is a valid glob pattern or patterns. | [homepage](https://github.com/jonschlinkert/is-valid-glob) * [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) ## Running tests Install dev dependencies: ```sh $ 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/has-glob/issues/new). ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2015 Jon Schlinkert Released under the MIT license. *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 18, 2015._