Comparing version 1.0.0 to 1.1.0
@@ -7,3 +7,2 @@ 'use strict'; | ||
var debug = require('debug')('extglob'); | ||
var extend = require('extend-shallow'); | ||
@@ -39,5 +38,3 @@ var unique = require('array-unique'); | ||
function extglob(pattern, options) { | ||
debug('initializing from <%s>', __filename); | ||
var res = extglob.create(pattern, options); | ||
return res.output; | ||
return extglob.create(pattern, options).output; | ||
} | ||
@@ -44,0 +41,0 @@ |
@@ -10,3 +10,11 @@ 'use strict'; | ||
module.exports = function(extglob) { | ||
var star = extglob.options.star || '.*?'; | ||
function star() { | ||
if (typeof extglob.options.star === 'function') { | ||
return extglob.options.star.apply(this, arguments); | ||
} | ||
if (typeof extglob.options.star === 'string') { | ||
return extglob.options.star; | ||
} | ||
return '.*?'; | ||
} | ||
@@ -91,3 +99,3 @@ /** | ||
return this.emit(prefix + star, node); | ||
return this.emit(prefix + star.call(this, node), node); | ||
}) | ||
@@ -100,3 +108,2 @@ | ||
.set('paren', function(node) { | ||
node.prev = this.prev(); | ||
return this.mapVisit(node.nodes); | ||
@@ -109,9 +116,10 @@ }) | ||
return this.emit('(?:(?!(?:', node); | ||
case '@': | ||
case '*': | ||
case '+': | ||
case '*': | ||
case '?': | ||
case '@': | ||
return this.emit('(', node); | ||
default: { | ||
return this.emit(node.val, node); | ||
var val = (this.options.bash === true ? '\\' : '') + node.val; | ||
return this.emit(val, node); | ||
} | ||
@@ -121,20 +129,15 @@ } | ||
.set('paren.close', function(node) { | ||
if (!node.parent.prev) { | ||
return this.emit('\\' + node.val, node); | ||
} | ||
switch (node.prefix) { | ||
case '!': | ||
case '^': | ||
var rest = node.rest; | ||
var val = !this.options.bash | ||
? '))' + star + ')' | ||
: ').)*$)'; | ||
var prefix = /^(\)|$)/.test(node.rest) ? '$' : ''; | ||
var str = star.call(this, node); | ||
var boundary = !rest || /^[).]/.test(rest); | ||
if (!node.suffix && !this.options.bash && boundary) { | ||
val = '$' + val; | ||
// if the extglob has a slash explicitly defined, we know the user wants | ||
// to match slashes, so we need to change the "star" regex accordingly | ||
if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) { | ||
str = '.*?'; | ||
} | ||
return this.emit(val, node); | ||
return this.emit(prefix + ('))' + str + ')'), node); | ||
case '+': | ||
@@ -147,4 +150,6 @@ return this.emit(')+', node); | ||
case '@': | ||
return this.emit(')', node); | ||
default: { | ||
return this.emit(')', node); | ||
var val = (this.options.bash === true ? '\\' : '') + ')'; | ||
return this.emit(val, node); | ||
} | ||
@@ -151,0 +156,0 @@ } |
@@ -10,3 +10,2 @@ 'use strict'; | ||
var extend = require('extend-shallow'); | ||
var debug = require('debug')('extglob'); | ||
@@ -25,3 +24,2 @@ /** | ||
function Extglob(options) { | ||
debug('initializing from <%s>', __filename); | ||
this.options = extend({source: 'extglob'}, options); | ||
@@ -28,0 +26,0 @@ this.snapdragon = this.options.snapdragon || new Snapdragon(this.options); |
@@ -5,2 +5,7 @@ 'use strict'; | ||
var Cache = require('fragment-cache'); | ||
/** | ||
* Utils | ||
*/ | ||
var utils = module.exports; | ||
@@ -7,0 +12,0 @@ var cache = utils.cache = new Cache(); |
{ | ||
"name": "extglob", | ||
"description": "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/jonschlinkert/extglob", | ||
@@ -30,3 +30,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"array-unique": "^0.3.2", | ||
"debug": "^2.2.0", | ||
"define-property": "^0.2.5", | ||
@@ -100,2 +99,2 @@ "expand-brackets": "^2.0.1", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32165
8
624
0
- Removeddebug@^2.2.0