Blame view

node_modules/is-glob/README.md 3.14 KB
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  # 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)
  
  > 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.
  
  Also take a look at [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
  
  ## Install
  
  Install with [npm](https://www.npmjs.com/)
  
  ```sh
  $ npm i is-glob --save
  ```
  
  ## Usage
  
  ```js
  var isGlob = require('is-glob');
  ```
  
  **True**
  
  Patterns that have glob characters or regex patterns will return `true`:
  
  ```js
  isGlob('!foo.js');
  isGlob('*.js');
  isGlob('**/abc.js');
  isGlob('abc/*.js');
  isGlob('abc/(aaa|bbb).js');
  isGlob('abc/[a-z].js');
  isGlob('abc/{a,b}.js');
  isGlob('abc/?.js');
  //=> true
  ```
  
  Extglobs
  
  ```js
  isGlob('abc/@(a).js');
  isGlob('abc/!(a).js');
  isGlob('abc/+(a).js');
  isGlob('abc/*(a).js');
  isGlob('abc/?(a).js');
  //=> true
  ```
  
  **False**
  
  Patterns that do not have glob patterns return `false`:
  
  ```js
  isGlob('abc.js');
  isGlob('abc/def/ghi.js');
  isGlob('foo.js');
  isGlob('abc/@.js');
  isGlob('abc/+.js');
  isGlob();
  isGlob(null);
  //=> false
  ```
  
  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)):
  
  ```js
  isGlob(['**/*.js']);
  isGlob(['foo.js']);
  //=> false
  ```
  
  ## Related
  
  * [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)
  * [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob)
  * [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)
  * [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)
  
  ## Run 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/is-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 02, 2015._