You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .verb.md
+42-65
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> {%= description %}
4
4
5
-
**BREAKING CHANGES in 2.0**
5
+
**Changes from v1.0.0 to v{%= version %}**
6
6
7
7
- all path-related properties are now on the `path` object
8
8
- all boolean properties are now on the `is` object
@@ -21,82 +21,59 @@ See the tests for [hundreds of examples](./test.js).
21
21
22
22
```js
23
23
var parseGlob =require('{%= name %}');
24
-
parseGlob('a/b/{c,d}/*.js');
25
24
```
26
25
27
-
**Returns:**
26
+
**Example**
28
27
29
28
```js
30
-
{ path:
31
-
{ dirname:'a/b/{c,d}/',
32
-
filename:'*.js',
33
-
basename:'*',
34
-
extname:'.js',
35
-
ext:'js' },
36
-
is: { glob:true, braces:true, negated:false, globstar:false,
37
-
dotfile:false, dotdir:false },
38
-
original:'a/b/{c,d}/*.js',
39
-
pattern:'a/b/{c,d}/*.js' }
29
+
parseGlob('a/b/c/**/*.{yml,json}');
40
30
```
41
31
42
-
## Properties
43
-
44
-
The object returned by parseGlob has the following properties:
45
-
46
-
-`pattern`: the glob pattern
47
-
-`base`: when `true` is passed as the second argument, a `base` path is extracted and stripped from `pattern`. See more [below](#base-property)
48
-
-`original`: a copy of the original, unmodified glob pattern
49
-
-`path`: file path segments
50
-
+`path.dirname`: directory
51
-
+`path.filename`: filename, including extension
52
-
+`path.basename`: filename, without extension
53
-
+`path.extname`: file extension, with dot
54
-
+`path.ext`: file extension, without dot
55
-
-`is`: an object with boolean information about the glob:
56
-
+`is.glob`: true if the pattern actually a glob pattern
57
-
+`is.negated`: true if it's a negation pattern (`!**/foo.js`)
58
-
+`is.globstar`: true if the pattern has a double star (`**`)
59
-
+`is.dotfile`: true if the pattern should match dotfiles
60
-
+`is.dotdir`: true if the pattern should match dot-directories (like `.git`)
61
-
62
-
63
-
### base property
64
-
65
-
The `base` property is created by taking any leading dirname segments in the pattern that do not contain any glob symbols (`!*{}?(|)[]`). If a base cannot be extracted, the value of `base` will be an empty string.
66
-
67
-
**Examples**
68
-
69
-
Without `base` defined:
32
+
**Returns:**
70
33
71
34
```js
72
-
var tokens =parseGlob('a/b/{c,d}/*.js');
73
-
// tokens.base => 'undefined'
74
-
// tokens.pattern => 'a/b/{c,d}/*.js'
35
+
{ orig:'a/b/c/**/*.{yml,json}',
36
+
is:
37
+
{ glob:true,
38
+
negated:false,
39
+
extglob:false,
40
+
braces:true,
41
+
brackets:false,
42
+
globstar:true,
43
+
dotfile:false,
44
+
dotdir:false },
45
+
glob:'**/*.{yml,json}',
46
+
base:'a/b/c',
47
+
path:
48
+
{ dirname:'a/b/c/**/',
49
+
basename:'*.{yml,json}',
50
+
filename:'*',
51
+
extname:'.{yml,json}',
52
+
ext:'{yml,json}' } }
75
53
```
76
54
77
-
With `base` defined:
78
-
79
-
```js
80
-
var tokens =parseGlob('a/b/{c,d}/*.js', true);
81
-
// tokens.base => 'a/b'
82
-
// tokens.pattern => '{c,d}/*.js'
83
-
```
55
+
## Properties
84
56
85
-
The resulting object would be:
57
+
The object returned by parseGlob has the following properties:
86
58
87
-
```js
88
-
{ path:
89
-
{ dirname:'a/b/{c,d}/',
90
-
filename:'*.js',
91
-
basename:'*',
92
-
extname:'.js',
93
-
ext:'js' },
94
-
is: { glob:true, negated:false, globstar:false,
95
-
dotfile:false, dotdir:false },
96
-
original:'a/b/{c,d}/*.js',
97
-
pattern:'{c,d}/*.js',
98
-
base:'a/b' }
99
-
```
59
+
-`orig`: a copy of the original, unmodified glob pattern
60
+
-`is`: an object with boolean information about the glob:
61
+
+`glob`: true if the pattern actually a glob pattern
62
+
+`negated`: true if it's a negation pattern (`!**/foo.js`)
63
+
+`extglob`: true if it has extglobs (`@(foo|bar)`)
64
+
+`braces`: true if it has braces (`{1..2}` or `.{txt,md}`)
65
+
+`brackets`: true if it has POSIX brackets (`[[:alpha:]]`)
66
+
+`globstar`: true if the pattern has a globstar (double star, `**`)
67
+
+`dotfile`: true if the pattern should match dotfiles
68
+
+`dotdir`: true if the pattern should match dot-directories (like `.git`)
69
+
-`glob`: the glob pattern part of the string, if any
Copy file name to clipboardExpand all lines: README.md
+44-67
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> Parse a glob pattern into an object of tokens.
4
4
5
-
**BREAKING CHANGES in 2.0**
5
+
**Changes from v1.0.0 to v3.0.0**
6
6
7
7
- all path-related properties are now on the `path` object
8
8
- all boolean properties are now on the `is` object
@@ -25,85 +25,62 @@ See the tests for [hundreds of examples](./test.js).
25
25
26
26
```js
27
27
var parseGlob =require('parse-glob');
28
-
parseGlob('a/b/{c,d}/*.js');
29
28
```
30
29
31
-
**Returns:**
30
+
**Example**
32
31
33
32
```js
34
-
{ path:
35
-
{ dirname:'a/b/{c,d}/',
36
-
filename:'*.js',
37
-
basename:'*',
38
-
extname:'.js',
39
-
ext:'js' },
40
-
is: { glob:true, braces:true, negated:false, globstar:false,
41
-
dotfile:false, dotdir:false },
42
-
original:'a/b/{c,d}/*.js',
43
-
pattern:'a/b/{c,d}/*.js' }
33
+
parseGlob('a/b/c/**/*.{yml,json}');
44
34
```
45
35
46
-
## Properties
47
-
48
-
The object returned by parseGlob has the following properties:
49
-
50
-
-`pattern`: the glob pattern
51
-
-`base`: when `true` is passed as the second argument, a `base` path is extracted and stripped from `pattern`. See more [below](#base-property)
52
-
-`original`: a copy of the original, unmodified glob pattern
53
-
-`path`: file path segments
54
-
+`path.dirname`: directory
55
-
+`path.filename`: filename, including extension
56
-
+`path.basename`: filename, without extension
57
-
+`path.extname`: file extension, with dot
58
-
+`path.ext`: file extension, without dot
59
-
-`is`: an object with boolean information about the glob:
60
-
+`is.glob`: true if the pattern actually a glob pattern
61
-
+`is.negated`: true if it's a negation pattern (`!**/foo.js`)
62
-
+`is.globstar`: true if the pattern has a double star (`**`)
63
-
+`is.dotfile`: true if the pattern should match dotfiles
64
-
+`is.dotdir`: true if the pattern should match dot-directories (like `.git`)
65
-
66
-
67
-
### base property
68
-
69
-
The `base` property is created by taking any leading dirname segments in the pattern that do not contain any glob symbols (`!*{}?(|)[]`). If a base cannot be extracted, the value of `base` will be an empty string.
70
-
71
-
**Examples**
72
-
73
-
Without `base` defined:
36
+
**Returns:**
74
37
75
38
```js
76
-
var tokens =parseGlob('a/b/{c,d}/*.js');
77
-
// tokens.base => 'undefined'
78
-
// tokens.pattern => 'a/b/{c,d}/*.js'
39
+
{ orig:'a/b/c/**/*.{yml,json}',
40
+
is:
41
+
{ glob:true,
42
+
negated:false,
43
+
extglob:false,
44
+
braces:true,
45
+
brackets:false,
46
+
globstar:true,
47
+
dotfile:false,
48
+
dotdir:false },
49
+
glob:'**/*.{yml,json}',
50
+
base:'a/b/c',
51
+
path:
52
+
{ dirname:'a/b/c/**/',
53
+
basename:'*.{yml,json}',
54
+
filename:'*',
55
+
extname:'.{yml,json}',
56
+
ext:'{yml,json}' } }
79
57
```
80
58
81
-
With `base` defined:
82
-
83
-
```js
84
-
var tokens =parseGlob('a/b/{c,d}/*.js', true);
85
-
// tokens.base => 'a/b'
86
-
// tokens.pattern => '{c,d}/*.js'
87
-
```
59
+
## Properties
88
60
89
-
The resulting object would be:
61
+
The object returned by parseGlob has the following properties:
90
62
91
-
```js
92
-
{ path:
93
-
{ dirname:'a/b/{c,d}/',
94
-
filename:'*.js',
95
-
basename:'*',
96
-
extname:'.js',
97
-
ext:'js' },
98
-
is: { glob:true, negated:false, globstar:false,
99
-
dotfile:false, dotdir:false },
100
-
original:'a/b/{c,d}/*.js',
101
-
pattern:'{c,d}/*.js',
102
-
base:'a/b' }
103
-
```
63
+
-`orig`: a copy of the original, unmodified glob pattern
64
+
-`is`: an object with boolean information about the glob:
65
+
+`glob`: true if the pattern actually a glob pattern
66
+
+`negated`: true if it's a negation pattern (`!**/foo.js`)
67
+
+`extglob`: true if it has extglobs (`@(foo|bar)`)
68
+
+`braces`: true if it has braces (`{1..2}` or `.{txt,md}`)
69
+
+`brackets`: true if it has POSIX brackets (`[[:alpha:]]`)
70
+
+`globstar`: true if the pattern has a globstar (double star, `**`)
71
+
+`dotfile`: true if the pattern should match dotfiles
72
+
+`dotdir`: true if the pattern should match dot-directories (like `.git`)
73
+
-`glob`: the glob pattern part of the string, if any
74
+
-`base`: the non-glob part of the string, if any
75
+
-`path`: file path segments
76
+
+`dirname`: directory
77
+
+`basename`: file name with extension
78
+
+`filename`: file name without extension
79
+
+`extname`: file extension with dot
80
+
+`ext`: file extension without dot
104
81
105
82
## Related
106
-
*[glob-base](https://github.com/jonschlinkert/glob-base): Split a glob into a base path and a pattern.
83
+
*[glob-base](https://github.com/jonschlinkert/glob-base): Returns an object with the (non-glob) base path and the actual pattern.
107
84
*[glob-parent](https://github.com/es128/glob-parent): Strips glob magic from a string to provide the parent path
108
85
*[is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.
109
86
*[glob-path-regex](https://github.com/regexps/glob-path-regex): Regular expression for matching the parts of glob pattern.
@@ -134,4 +111,4 @@ Released under the MIT license
134
111
135
112
***
136
113
137
-
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 06, 2015._
114
+
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 08, 2015._
0 commit comments