1
1
module . exports = minimatch
2
2
minimatch . Minimatch = Minimatch
3
3
4
- const path = ( ( ) => { try { return require ( 'path' ) } catch ( e ) { } } ) ( ) || {
4
+ var path = ( function ( ) { try { return require ( 'path' ) } catch ( e ) { } } ( ) ) || {
5
5
sep : '/'
6
6
}
7
7
minimatch . sep = path . sep
8
8
9
- const GLOBSTAR = minimatch . GLOBSTAR = Minimatch . GLOBSTAR = { }
10
- const expand = require ( 'brace-expansion' )
9
+ var GLOBSTAR = minimatch . GLOBSTAR = Minimatch . GLOBSTAR = { }
10
+ var expand = require ( 'brace-expansion' )
11
11
12
- const plTypes = {
12
+ var plTypes = {
13
13
'!' : { open : '(?:(?!(?:' , close : '))[^/]*?)' } ,
14
14
'?' : { open : '(?:' , close : ')?' } ,
15
15
'+' : { open : '(?:' , close : ')+' } ,
@@ -19,22 +19,22 @@ const plTypes = {
19
19
20
20
// any single thing other than /
21
21
// don't need to escape / when using new RegExp()
22
- const qmark = '[^/]'
22
+ var qmark = '[^/]'
23
23
24
24
// * => any number of characters
25
- const star = qmark + '*?'
25
+ var star = qmark + '*?'
26
26
27
27
// ** when dots are allowed. Anything goes, except .. and .
28
28
// not (^ or / followed by one or two dots followed by $ or /),
29
29
// followed by anything, any number of times.
30
- const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
30
+ var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
31
31
32
32
// not a ^ or / followed by a dot,
33
33
// followed by anything, any number of times.
34
- const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
34
+ var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
35
35
36
36
// characters that need to be escaped in RegExp.
37
- const reSpecials = charSet ( '().*{}+?[]^$\\!' )
37
+ var reSpecials = charSet ( '().*{}+?[]^$\\!' )
38
38
39
39
// "abc" -> { a:true, b:true, c:true }
40
40
function charSet ( s ) {
@@ -45,7 +45,7 @@ function charSet (s) {
45
45
}
46
46
47
47
// normalizes slashes.
48
- const slashSplit = / \/ + /
48
+ var slashSplit = / \/ + /
49
49
50
50
minimatch . filter = filter
51
51
function filter ( pattern , options ) {
@@ -57,7 +57,7 @@ function filter (pattern, options) {
57
57
58
58
function ext ( a , b ) {
59
59
b = b || { }
60
- const t = { }
60
+ var t = { }
61
61
Object . keys ( a ) . forEach ( function ( k ) {
62
62
t [ k ] = a [ k ]
63
63
} )
@@ -72,16 +72,16 @@ minimatch.defaults = function (def) {
72
72
return minimatch
73
73
}
74
74
75
- const orig = minimatch
75
+ var orig = minimatch
76
76
77
- const m = function minimatch ( p , pattern , options ) {
77
+ var m = function minimatch ( p , pattern , options ) {
78
78
return orig ( p , pattern , ext ( def , options ) )
79
79
}
80
80
81
81
m . Minimatch = function Minimatch ( pattern , options ) {
82
82
return new orig . Minimatch ( pattern , ext ( def , options ) )
83
83
}
84
- m . Minimatch . defaults = options => {
84
+ m . Minimatch . defaults = function defaults ( options ) {
85
85
return orig . defaults ( ext ( def , options ) ) . Minimatch
86
86
}
87
87
@@ -175,7 +175,7 @@ function make () {
175
175
// step 2: expand braces
176
176
var set = this . globSet = this . braceExpand ( )
177
177
178
- if ( options . debug ) this . debug = ( ... args ) => console . error ( ... args )
178
+ if ( options . debug ) this . debug = function debug ( ) { console . error . apply ( console , arguments ) }
179
179
180
180
this . debug ( this . pattern , set )
181
181
@@ -267,8 +267,8 @@ function braceExpand (pattern, options) {
267
267
return expand ( pattern )
268
268
}
269
269
270
- const MAX_PATTERN_LENGTH = 1024 * 64
271
- const assertValidPattern = pattern => {
270
+ var MAX_PATTERN_LENGTH = 1024 * 64
271
+ var assertValidPattern = function ( pattern ) {
272
272
if ( typeof pattern !== 'string' ) {
273
273
throw new TypeError ( 'invalid pattern' )
274
274
}
@@ -290,7 +290,7 @@ const assertValidPattern = pattern => {
290
290
// of * is equivalent to a single *. Globstar behavior is enabled by
291
291
// default, and can be disabled by setting options.noglobstar.
292
292
Minimatch . prototype . parse = parse
293
- const SUBPARSE = { }
293
+ var SUBPARSE = { }
294
294
function parse ( pattern , isSub ) {
295
295
assertValidPattern ( pattern )
296
296
@@ -710,7 +710,7 @@ function makeRe () {
710
710
711
711
minimatch . match = function ( list , pattern , options ) {
712
712
options = options || { }
713
- const mm = new Minimatch ( pattern , options )
713
+ var mm = new Minimatch ( pattern , options )
714
714
list = list . filter ( function ( f ) {
715
715
return mm . match ( f )
716
716
} )
@@ -720,7 +720,8 @@ minimatch.match = function (list, pattern, options) {
720
720
return list
721
721
}
722
722
723
- Minimatch . prototype . match = function match ( f , partial = this . partial ) {
723
+ Minimatch . prototype . match = function match ( f , partial ) {
724
+ if ( typeof partial === 'undefined' ) partial = this . partial
724
725
this . debug ( 'match' , f , this . pattern )
725
726
// short-circuit in the case of busted things.
726
727
// comments, etc.
0 commit comments