Initial commit
[yaffs-website] / node_modules / is-glob / README.md
1 # is-glob [![NPM version](https://badge.fury.io/js/is-glob.svg)](http://badge.fury.io/js/is-glob)  [![Build Status](https://travis-ci.org/jonschlinkert/is-glob.svg)](https://travis-ci.org/jonschlinkert/is-glob)
2
3 > Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.
4
5 Also take a look at [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
6
7 ## Install
8
9 Install with [npm](https://www.npmjs.com/)
10
11 ```sh
12 $ npm i is-glob --save
13 ```
14
15 ## Usage
16
17 ```js
18 var isGlob = require('is-glob');
19 ```
20
21 **True**
22
23 Patterns that have glob characters or regex patterns will return `true`:
24
25 ```js
26 isGlob('!foo.js');
27 isGlob('*.js');
28 isGlob('**/abc.js');
29 isGlob('abc/*.js');
30 isGlob('abc/(aaa|bbb).js');
31 isGlob('abc/[a-z].js');
32 isGlob('abc/{a,b}.js');
33 isGlob('abc/?.js');
34 //=> true
35 ```
36
37 Extglobs
38
39 ```js
40 isGlob('abc/@(a).js');
41 isGlob('abc/!(a).js');
42 isGlob('abc/+(a).js');
43 isGlob('abc/*(a).js');
44 isGlob('abc/?(a).js');
45 //=> true
46 ```
47
48 **False**
49
50 Patterns that do not have glob patterns return `false`:
51
52 ```js
53 isGlob('abc.js');
54 isGlob('abc/def/ghi.js');
55 isGlob('foo.js');
56 isGlob('abc/@.js');
57 isGlob('abc/+.js');
58 isGlob();
59 isGlob(null);
60 //=> false
61 ```
62
63 Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)):
64
65 ```js
66 isGlob(['**/*.js']);
67 isGlob(['foo.js']);
68 //=> false
69 ```
70
71 ## Related
72
73 * [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob)
74 * [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob)
75 * [is-posix-bracket](https://www.npmjs.com/package/is-posix-bracket): Returns true if the given string is a POSIX bracket expression (POSIX character class). | [homepage](https://github.com/jonschlinkert/is-posix-bracket)
76 * [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)
77 * [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)
78
79 ## Run tests
80
81 Install dev dependencies:
82
83 ```sh
84 $ npm i -d && npm test
85 ```
86
87 ## Contributing
88
89 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-glob/issues/new).
90
91 ## Author
92
93 **Jon Schlinkert**
94
95 + [github/jonschlinkert](https://github.com/jonschlinkert)
96 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
97
98 ## License
99
100 Copyright © 2015 Jon Schlinkert
101 Released under the MIT license.
102
103 ***
104
105 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 02, 2015._