extglob
Advanced tools
Comparing version 2.0.4 to 3.0.0
## Changelog | ||
### v3.0.0 | ||
**Breaking changes** | ||
- Snapdragon was updated to 0.12. Other packages that integrate `extglob` need to also use snapdragon 0.12. | ||
- Minimum Node.JS version is now version 4. | ||
### v2.0.0 | ||
@@ -4,0 +12,0 @@ |
67
index.js
@@ -7,5 +7,4 @@ 'use strict'; | ||
var extend = require('extend-shallow'); | ||
var unique = require('array-unique'); | ||
var toRegex = require('to-regex'); | ||
const unique = require('array-unique'); | ||
const toRegex = require('to-regex'); | ||
@@ -16,7 +15,7 @@ /** | ||
var compilers = require('./lib/compilers'); | ||
var parsers = require('./lib/parsers'); | ||
var Extglob = require('./lib/extglob'); | ||
var utils = require('./lib/utils'); | ||
var MAX_LENGTH = 1024 * 64; | ||
const compilers = require('./lib/compilers'); | ||
const parsers = require('./lib/parsers'); | ||
const Extglob = require('./lib/extglob'); | ||
const utils = require('./lib/utils'); | ||
const MAX_LENGTH = 1024 * 64; | ||
@@ -28,3 +27,3 @@ /** | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* console.log(extglob('*.!(*a)')); | ||
@@ -48,3 +47,3 @@ * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)')); | ||
@@ -66,9 +65,9 @@ * //=> ['a.b', 'a.c'] | ||
list = utils.arrayify(list); | ||
var isMatch = extglob.matcher(pattern, options); | ||
var len = list.length; | ||
var idx = -1; | ||
var matches = []; | ||
const isMatch = extglob.matcher(pattern, options); | ||
const len = list.length; | ||
let idx = -1; | ||
const matches = []; | ||
while (++idx < len) { | ||
var ele = list[idx]; | ||
const ele = list[idx]; | ||
@@ -102,3 +101,3 @@ if (isMatch(ele)) { | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* | ||
@@ -134,3 +133,3 @@ * console.log(extglob.isMatch('a.a', '*.!(*a)')); | ||
var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher); | ||
const isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher); | ||
return isMatch(str); | ||
@@ -144,3 +143,3 @@ }; | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* console.log(extglob.contains('aa/bb/cc', '*b')); | ||
@@ -167,3 +166,3 @@ * //=> true | ||
var opts = extend({}, options, {contains: true}); | ||
const opts = Object.assign({}, options, {contains: true}); | ||
opts.strictClose = false; | ||
@@ -179,4 +178,4 @@ opts.strictOpen = false; | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* var isMatch = extglob.matcher('*.!(*a)'); | ||
* const extglob = require('extglob'); | ||
* const isMatch = extglob.matcher('*.!(*a)'); | ||
* | ||
@@ -200,3 +199,3 @@ * console.log(isMatch('a.a')); | ||
function matcher() { | ||
var re = extglob.makeRe(pattern, options); | ||
const re = extglob.makeRe(pattern, options); | ||
return function(str) { | ||
@@ -215,3 +214,3 @@ return re.test(str); | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* console.log(extglob.create('*.!(*a)').output); | ||
@@ -232,4 +231,4 @@ * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' | ||
function create() { | ||
var ext = new Extglob(options); | ||
var ast = ext.parse(pattern, options); | ||
const ext = new Extglob(options); | ||
const ast = ext.parse(pattern, options); | ||
return ext.compile(ast, options); | ||
@@ -246,3 +245,3 @@ } | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* const extglob = require('extglob'); | ||
* extglob.capture(pattern, string[, options]); | ||
@@ -263,7 +262,7 @@ * | ||
extglob.capture = function(pattern, str, options) { | ||
var re = extglob.makeRe(pattern, extend({capture: true}, options)); | ||
const re = extglob.makeRe(pattern, Object.assign({capture: true}, options)); | ||
function match() { | ||
return function(string) { | ||
var match = re.exec(string); | ||
const match = re.exec(string); | ||
if (!match) { | ||
@@ -277,3 +276,3 @@ return null; | ||
var capture = utils.memoize('capture', pattern, options, match); | ||
const capture = utils.memoize('capture', pattern, options, match); | ||
return capture(str); | ||
@@ -286,4 +285,4 @@ }; | ||
* ```js | ||
* var extglob = require('extglob'); | ||
* var re = extglob.makeRe('*.!(*a)'); | ||
* const extglob = require('extglob'); | ||
* const re = extglob.makeRe('*.!(*a)'); | ||
* console.log(re); | ||
@@ -312,9 +311,9 @@ * //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/ | ||
function makeRe() { | ||
var opts = extend({strictErrors: false}, options); | ||
const opts = Object.assign({strictErrors: false}, options); | ||
if (opts.strictErrors === true) opts.strict = true; | ||
var res = extglob.create(pattern, opts); | ||
const res = extglob.create(pattern, opts); | ||
return toRegex(res.output, opts); | ||
} | ||
var regex = utils.memoize('makeRe', pattern, options, makeRe); | ||
const regex = utils.memoize('makeRe', pattern, options, makeRe); | ||
if (regex.source.length > MAX_LENGTH) { | ||
@@ -321,0 +320,0 @@ throw new SyntaxError('potentially malicious regex detected'); |
'use strict'; | ||
var brackets = require('expand-brackets'); | ||
const brackets = require('expand-brackets'); | ||
@@ -48,7 +48,7 @@ /** | ||
.set('qmark', function(node) { | ||
var val = '[^\\\\/.]'; | ||
var prev = this.prev(); | ||
let val = '[^\\\\/.]'; | ||
const prev = node.prev; | ||
if (node.parsed.slice(-1) === '(') { | ||
var ch = node.rest.charAt(0); | ||
const ch = node.rest.charAt(0); | ||
if (ch !== '!' && ch !== '=' && ch !== ':') { | ||
@@ -75,7 +75,7 @@ return this.emit(val, node); | ||
.set('plus', function(node) { | ||
var prev = node.parsed.slice(-1); | ||
const prev = node.parsed.slice(-1); | ||
if (prev === ']' || prev === ')') { | ||
return this.emit(node.val, node); | ||
} | ||
var ch = this.output.slice(-1); | ||
const ch = this.output.slice(-1); | ||
if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) { | ||
@@ -95,4 +95,4 @@ return this.emit('\\+', node); | ||
.set('star', function(node) { | ||
var prev = this.prev(); | ||
var prefix = prev.type !== 'text' && prev.type !== 'escape' | ||
const prev = node.prev; | ||
const prefix = prev.type !== 'text' && prev.type !== 'escape' | ||
? '(?!\\.)' | ||
@@ -109,6 +109,6 @@ : ''; | ||
.set('paren', function(node) { | ||
return this.mapVisit(node.nodes); | ||
this.mapVisit(node); | ||
}) | ||
.set('paren.open', function(node) { | ||
var capture = this.options.capture ? '(' : ''; | ||
const capture = this.options.capture ? '(' : ''; | ||
@@ -125,3 +125,3 @@ switch (node.parent.prefix) { | ||
default: { | ||
var val = node.val; | ||
let val = node.val; | ||
if (this.options.bash === true) { | ||
@@ -138,3 +138,3 @@ val = '\\' + val; | ||
.set('paren.close', function(node) { | ||
var capture = this.options.capture ? ')' : ''; | ||
const capture = this.options.capture ? ')' : ''; | ||
@@ -144,4 +144,4 @@ switch (node.prefix) { | ||
case '^': | ||
var prefix = /^(\)|$)/.test(node.rest) ? '$' : ''; | ||
var str = star.call(this, node); | ||
const prefix = /^(\)|$)/.test(node.rest) ? '$' : ''; | ||
let str = star.call(this, node); | ||
@@ -162,3 +162,3 @@ // if the extglob has a slash explicitly defined, we know the user wants | ||
default: { | ||
var val = (this.options.bash === true ? '\\' : '') + ')'; | ||
const val = (this.options.bash === true ? '\\' : '') + ')'; | ||
return this.emit(val, node); | ||
@@ -174,5 +174,5 @@ } | ||
.set('text', function(node) { | ||
var val = node.val.replace(/[\[\]]/g, '\\$&'); | ||
const val = node.val.replace(/[\[\]]/g, '\\$&'); | ||
return this.emit(val, node); | ||
}); | ||
}; |
@@ -7,5 +7,5 @@ 'use strict'; | ||
var Snapdragon = require('snapdragon'); | ||
var define = require('define-property'); | ||
var extend = require('extend-shallow'); | ||
const Snapdragon = require('snapdragon'); | ||
const capture = require('snapdragon-capture'); | ||
const define = require('define-property'); | ||
@@ -16,4 +16,4 @@ /** | ||
var compilers = require('./compilers'); | ||
var parsers = require('./parsers'); | ||
const compilers = require('./compilers'); | ||
const parsers = require('./parsers'); | ||
@@ -25,4 +25,5 @@ /** | ||
function Extglob(options) { | ||
this.options = extend({source: 'extglob'}, options); | ||
this.options = Object.assign({source: 'extglob'}, options); | ||
this.snapdragon = this.options.snapdragon || new Snapdragon(this.options); | ||
this.snapdragon.use(capture()); | ||
this.snapdragon.patterns = this.snapdragon.patterns || {}; | ||
@@ -40,11 +41,11 @@ this.compiler = this.snapdragon.compiler; | ||
define(this.snapdragon, 'parse', function(str, options) { | ||
var parsed = Snapdragon.prototype.parse.apply(this, arguments); | ||
const parsed = Snapdragon.prototype.parse.apply(this, arguments); | ||
parsed.input = str; | ||
// escape unmatched brace/bracket/parens | ||
var last = this.parser.stack.pop(); | ||
const last = this.parser.stack.pop(); | ||
if (last && this.options.strict !== true) { | ||
var node = last.nodes[0]; | ||
const node = last.nodes[0]; | ||
node.val = '\\' + node.val; | ||
var sibling = node.parent.nodes[1]; | ||
const sibling = node.parent.nodes[1]; | ||
if (sibling.type === 'star') { | ||
@@ -51,0 +52,0 @@ sibling.loose = true; |
'use strict'; | ||
var brackets = require('expand-brackets'); | ||
var define = require('define-property'); | ||
var utils = require('./utils'); | ||
const brackets = require('expand-brackets'); | ||
const utils = require('./utils'); | ||
@@ -12,4 +11,4 @@ /** | ||
var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+'; | ||
var not = utils.createRegex(TEXT_REGEX); | ||
const TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+'; | ||
const not = utils.createRegex(TEXT_REGEX); | ||
@@ -35,22 +34,20 @@ /** | ||
.capture('paren.open', function() { | ||
var parsed = this.parsed; | ||
var pos = this.position(); | ||
var m = this.match(/^([!@*?+])?\(/); | ||
.set('paren.open', function() { | ||
const pos = this.position(); | ||
const m = this.match(/^([!@*?+])?\(/); | ||
if (!m) return; | ||
var prev = this.prev(); | ||
var prefix = m[1]; | ||
var val = m[0]; | ||
const prev = this.prev(); | ||
const prefix = m[1]; | ||
const val = m[0]; | ||
var open = pos({ | ||
const open = pos({ | ||
type: 'paren.open', | ||
parsed: parsed, | ||
val: val | ||
val | ||
}); | ||
var node = pos({ | ||
const node = pos({ | ||
type: 'paren', | ||
prefix: prefix, | ||
nodes: [open] | ||
prefix, | ||
nodes: [] | ||
}); | ||
@@ -64,9 +61,5 @@ | ||
define(node, 'rest', this.input); | ||
define(node, 'parsed', parsed); | ||
define(node, 'parent', prev); | ||
define(open, 'parent', node); | ||
this.pushNode(node, prev); | ||
this.pushNode(open, node); | ||
this.push('paren', node); | ||
prev.nodes.push(node); | ||
}) | ||
@@ -78,13 +71,13 @@ | ||
.capture('paren.close', function() { | ||
var parsed = this.parsed; | ||
var pos = this.position(); | ||
var m = this.match(/^\)/); | ||
.set('paren.close', function() { | ||
const parsed = this.parsed; | ||
const pos = this.position(); | ||
const m = this.match(/^\)/); | ||
if (!m) return; | ||
var parent = this.pop('paren'); | ||
var node = pos({ | ||
const parent = this.pop('paren'); | ||
const node = pos({ | ||
type: 'paren.close', | ||
rest: this.input, | ||
parsed: parsed, | ||
parsed, | ||
val: m[0] | ||
@@ -102,4 +95,3 @@ }); | ||
node.prefix = parent.prefix; | ||
parent.nodes.push(node); | ||
define(node, 'parent', parent); | ||
this.pushNode(node, parent); | ||
}) | ||
@@ -111,5 +103,5 @@ | ||
.capture('escape', function() { | ||
var pos = this.position(); | ||
var m = this.match(/^\\(.)/); | ||
.set('escape', function() { | ||
const pos = this.position(); | ||
const m = this.match(/^\\(.)/); | ||
if (!m) return; | ||
@@ -128,6 +120,6 @@ | ||
.capture('qmark', function() { | ||
var parsed = this.parsed; | ||
var pos = this.position(); | ||
var m = this.match(/^\?+(?!\()/); | ||
.set('qmark', function() { | ||
const parsed = this.parsed; | ||
const pos = this.position(); | ||
const m = this.match(/^\?+(?!\()/); | ||
if (!m) return; | ||
@@ -138,3 +130,3 @@ extglob.state.metachar = true; | ||
rest: this.input, | ||
parsed: parsed, | ||
parsed, | ||
val: m[0] | ||
@@ -141,0 +133,0 @@ }); |
'use strict'; | ||
var regex = require('regex-not'); | ||
var Cache = require('fragment-cache'); | ||
const regex = require('regex-not'); | ||
const Cache = require('fragment-cache'); | ||
@@ -10,4 +10,4 @@ /** | ||
var utils = module.exports; | ||
var cache = utils.cache = new Cache(); | ||
const utils = module.exports; | ||
const cache = utils.cache = new Cache(); | ||
@@ -31,3 +31,3 @@ /** | ||
utils.memoize = function(type, pattern, options, fn) { | ||
var key = utils.createKey(type + pattern, options); | ||
const key = utils.createKey(type + pattern, options); | ||
@@ -38,3 +38,3 @@ if (cache.has(type, key)) { | ||
var val = fn(pattern, options); | ||
const val = fn(pattern, options); | ||
if (options && options.cache === false) { | ||
@@ -55,7 +55,7 @@ return val; | ||
utils.createKey = function(pattern, options) { | ||
var key = pattern; | ||
let key = pattern; | ||
if (typeof options === 'undefined') { | ||
return key; | ||
} | ||
for (var prop in options) { | ||
for (const prop in options) { | ||
key += ';' + prop + '=' + String(options[prop]); | ||
@@ -71,4 +71,4 @@ } | ||
utils.createRegex = function(str) { | ||
var opts = {contains: true, strictClose: false}; | ||
const opts = {contains: true, strictClose: false}; | ||
return regex(str, opts); | ||
}; |
{ | ||
"name": "extglob", | ||
"description": "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.", | ||
"version": "2.0.4", | ||
"version": "3.0.0", | ||
"homepage": "https://github.com/micromatch/extglob", | ||
@@ -13,3 +13,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"Matt Bierner (http://mattbierner.com)", | ||
"Shinnosuke Watanabe (https://shinnn.github.io)" | ||
"Shinnosuke Watanabe (https://shinnn.github.io)", | ||
"Daniel Tschinder (https://github.com/danez)" | ||
], | ||
@@ -27,3 +28,3 @@ "repository": "micromatch/extglob", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4.0.0" | ||
}, | ||
@@ -35,8 +36,8 @@ "scripts": { | ||
"array-unique": "^0.3.2", | ||
"define-property": "^1.0.0", | ||
"expand-brackets": "^2.1.4", | ||
"extend-shallow": "^2.0.1", | ||
"define-property": "^2.0.2", | ||
"expand-brackets": "^4.0.0", | ||
"fragment-cache": "^0.2.1", | ||
"regex-not": "^1.0.0", | ||
"snapdragon": "^0.8.1", | ||
"snapdragon": "^0.12.0", | ||
"snapdragon-capture": "^0.2.0", | ||
"to-regex": "^3.0.1" | ||
@@ -43,0 +44,0 @@ }, |
161
README.md
@@ -1,7 +0,5 @@ | ||
# extglob [![NPM version](https://img.shields.io/npm/v/extglob.svg?style=flat)](https://www.npmjs.com/package/extglob) [![NPM monthly downloads](https://img.shields.io/npm/dm/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![NPM total downloads](https://img.shields.io/npm/dt/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![Linux Build Status](https://img.shields.io/travis/micromatch/extglob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/extglob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/extglob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/extglob) | ||
# extglob [![NPM version](https://img.shields.io/npm/v/extglob.svg?style=flat)](https://www.npmjs.com/package/extglob) [![NPM monthly downloads](https://img.shields.io/npm/dm/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![NPM total downloads](https://img.shields.io/npm/dt/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![Linux Build Status](https://img.shields.io/travis/micromatch/extglob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/extglob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/extglob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/extglob) | ||
> Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns. | ||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. | ||
## Install | ||
@@ -15,2 +13,8 @@ | ||
Install with [yarn](https://yarnpkg.com): | ||
```sh | ||
$ yarn add extglob | ||
``` | ||
* Convert an extglob string to a regex-compatible string. | ||
@@ -38,13 +42,13 @@ * More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch) (minimatch fails a large percentage of the extglob tests) | ||
| **pattern** | **regex equivalent** | **description** | | ||
| **pattern** | **regex equivalent** | **description** | | ||
| --- | --- | --- | | ||
| `?(pattern-list)` | `(...|...)?` | Matches zero or one occurrence of the given pattern(s) | | ||
| `*(pattern-list)` | `(...|...)*` | Matches zero or more occurrences of the given pattern(s) | | ||
| `+(pattern-list)` | `(...|...)+` | Matches one or more occurrences of the given pattern(s) | | ||
| `@(pattern-list)` | `(...|...)` <sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup> | Matches one of the given pattern(s) | | ||
| `!(pattern-list)` | N/A | Matches anything except one of the given pattern(s) | | ||
| `?(pattern-list)` | `(...\|...)?` | Matches zero or one occurrence of the given pattern(s) | | ||
| `*(pattern-list)` | `(...\|...)*` | Matches zero or more occurrences of the given pattern(s) | | ||
| `+(pattern-list)` | `(...\|...)+` | Matches one or more occurrences of the given pattern(s) | | ||
| `@(pattern-list)` | `(...\|...)` [^1] | Matches one of the given pattern(s) | | ||
| `!(pattern-list)` | N/A | Matches anything except one of the given pattern(s) | | ||
## API | ||
### [extglob](index.js#L36) | ||
### [extglob](index.js#L35) | ||
@@ -62,3 +66,3 @@ Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
console.log(extglob('*.!(*a)')); | ||
@@ -68,3 +72,3 @@ //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' | ||
### [.match](index.js#L56) | ||
### [.match](index.js#L55) | ||
@@ -83,3 +87,3 @@ Takes an array of strings and an extglob pattern and returns a new array that contains only the strings that match the pattern. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)')); | ||
@@ -89,3 +93,3 @@ //=> ['a.b', 'a.c'] | ||
### [.isMatch](index.js#L111) | ||
### [.isMatch](index.js#L110) | ||
@@ -104,3 +108,3 @@ Returns true if the specified `string` matches the given extglob `pattern`. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
@@ -113,3 +117,3 @@ console.log(extglob.isMatch('a.a', '*.!(*a)')); | ||
### [.contains](index.js#L150) | ||
### [.contains](index.js#L149) | ||
@@ -128,3 +132,3 @@ Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but the pattern can match any part of the string. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
console.log(extglob.contains('aa/bb/cc', '*b')); | ||
@@ -136,3 +140,3 @@ //=> true | ||
### [.matcher](index.js#L184) | ||
### [.matcher](index.js#L183) | ||
@@ -150,4 +154,4 @@ Takes an extglob pattern and returns a matcher function. The returned function takes the string to match as its only argument. | ||
```js | ||
var extglob = require('extglob'); | ||
var isMatch = extglob.matcher('*.!(*a)'); | ||
const extglob = require('extglob'); | ||
const isMatch = extglob.matcher('*.!(*a)'); | ||
@@ -160,3 +164,3 @@ console.log(isMatch('a.a')); | ||
### [.create](index.js#L214) | ||
### [.create](index.js#L213) | ||
@@ -174,3 +178,3 @@ Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
console.log(extglob.create('*.!(*a)').output); | ||
@@ -180,3 +184,3 @@ //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' | ||
### [.capture](index.js#L248) | ||
### [.capture](index.js#L247) | ||
@@ -195,3 +199,3 @@ Returns an array of matches captured by `pattern` in `string`, or `null` if the pattern did not match. | ||
```js | ||
var extglob = require('extglob'); | ||
const extglob = require('extglob'); | ||
extglob.capture(pattern, string[, options]); | ||
@@ -205,3 +209,3 @@ | ||
### [.makeRe](index.js#L281) | ||
### [.makeRe](index.js#L280) | ||
@@ -219,4 +223,4 @@ Create a regular expression from the given `pattern` and `options`. | ||
```js | ||
var extglob = require('extglob'); | ||
var re = extglob.makeRe('*.!(*a)'); | ||
const extglob = require('extglob'); | ||
const re = extglob.makeRe('*.!(*a)'); | ||
console.log(re); | ||
@@ -260,34 +264,34 @@ //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/ | ||
Last run on December 21, 2017 | ||
Last run on April 30, 2018 | ||
```sh | ||
# negation-nested (49 bytes) | ||
extglob x 2,228,255 ops/sec ±0.98% (89 runs sampled) | ||
minimatch x 207,875 ops/sec ±0.61% (91 runs sampled) | ||
extglob x 1,380,148 ops/sec ±3.35% (62 runs sampled) | ||
minimatch x 156,800 ops/sec ±4.13% (76 runs sampled) | ||
fastest is extglob (by 1072% avg) | ||
fastest is extglob (by 880% avg) | ||
# negation-simple (43 bytes) | ||
extglob x 2,205,668 ops/sec ±1.00% (91 runs sampled) | ||
minimatch x 311,923 ops/sec ±1.25% (91 runs sampled) | ||
extglob x 1,821,746 ops/sec ±1.61% (76 runs sampled) | ||
minimatch x 365,618 ops/sec ±1.87% (84 runs sampled) | ||
fastest is extglob (by 707% avg) | ||
fastest is extglob (by 498% avg) | ||
# range-false (57 bytes) | ||
extglob x 2,263,877 ops/sec ±0.40% (94 runs sampled) | ||
minimatch x 271,372 ops/sec ±1.02% (91 runs sampled) | ||
extglob x 2,038,592 ops/sec ±3.39% (85 runs sampled) | ||
minimatch x 310,897 ops/sec ±12.62% (87 runs sampled) | ||
fastest is extglob (by 834% avg) | ||
fastest is extglob (by 656% avg) | ||
# range-true (56 bytes) | ||
extglob x 2,161,891 ops/sec ±0.41% (92 runs sampled) | ||
minimatch x 268,265 ops/sec ±1.17% (91 runs sampled) | ||
extglob x 2,105,081 ops/sec ±0.69% (91 runs sampled) | ||
minimatch x 332,188 ops/sec ±0.45% (91 runs sampled) | ||
fastest is extglob (by 806% avg) | ||
fastest is extglob (by 634% avg) | ||
# star-simple (46 bytes) | ||
extglob x 2,211,081 ops/sec ±0.49% (92 runs sampled) | ||
minimatch x 343,319 ops/sec ±0.59% (91 runs sampled) | ||
extglob x 2,154,184 ops/sec ±0.99% (89 runs sampled) | ||
minimatch x 452,812 ops/sec ±0.51% (88 runs sampled) | ||
fastest is extglob (by 644% avg) | ||
fastest is extglob (by 476% avg) | ||
@@ -305,21 +309,27 @@ ``` | ||
<details> | ||
<summary><strong>Contributing</strong></summary> | ||
### Related projects | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.") | ||
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/micromatch/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") | ||
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by [micromatch].") | ||
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") | ||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") | ||
</details> | ||
### Contributing | ||
<details> | ||
<summary><strong>Running Tests</strong></summary> | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
### Contributors | ||
```sh | ||
$ npm install && npm test | ||
``` | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 54 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 6 | [danez](https://github.com/danez) | | ||
| 2 | [isiahmeadows](https://github.com/isiahmeadows) | | ||
| 1 | [doowb](https://github.com/doowb) | | ||
| 1 | [devongovett](https://github.com/devongovett) | | ||
| 1 | [mjbvz](https://github.com/mjbvz) | | ||
| 1 | [shinnn](https://github.com/shinnn) | | ||
</details> | ||
<details> | ||
<summary><strong>Building docs</strong></summary> | ||
### Building docs | ||
@@ -334,25 +344,10 @@ _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ | ||
</details> | ||
### Running tests | ||
### Related projects | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
You might also be interested in these projects: | ||
```sh | ||
$ npm install && npm test | ||
``` | ||
* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.") | ||
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") | ||
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by [micromatch].") | ||
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") | ||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") | ||
### Contributors | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 49 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 2 | [isiahmeadows](https://github.com/isiahmeadows) | | ||
| 1 | [doowb](https://github.com/doowb) | | ||
| 1 | [devongovett](https://github.com/devongovett) | | ||
| 1 | [mjbvz](https://github.com/mjbvz) | | ||
| 1 | [shinnn](https://github.com/shinnn) | | ||
### Author | ||
@@ -362,3 +357,2 @@ | ||
* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
@@ -369,3 +363,3 @@ * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) | ||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT License](LICENSE). | ||
@@ -375,11 +369,2 @@ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 21, 2017._ | ||
<hr class="footnotes-sep"> | ||
<section class="footnotes"> | ||
<ol class="footnotes-list"> | ||
<li id="fn1" class="footnote-item">`@` isn "'t a RegEx character." <a href="#fnref1" class="footnote-backref">↩</a> | ||
</li> | ||
</ol> | ||
</section> | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 30, 2018._ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
34533
9
655
347
1
+ Addedsnapdragon-capture@^0.2.0
+ Addedexpand-brackets@4.0.0(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedlazy-cache@2.0.2(transitive)
+ Addedposix-character-classes@1.0.0(transitive)
+ Addedset-getter@0.1.1(transitive)
+ Addedsnapdragon@0.12.1(transitive)
+ Addedsnapdragon-capture@0.2.0(transitive)
+ Addedsnapdragon-node@1.0.6(transitive)
+ Addedsnapdragon-util@1.0.64.0.0(transitive)
+ Addedsource-map-resolve@0.6.0(transitive)
- Removedextend-shallow@^2.0.1
- Removedarr-union@3.1.0(transitive)
- Removedbase@0.11.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddefine-property@1.0.0(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.1(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-number@3.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.0(transitive)
- Removedkind-of@4.0.0(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedset-value@2.0.1(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedurix@0.1.0(transitive)
Updateddefine-property@^2.0.2
Updatedexpand-brackets@^4.0.0
Updatedsnapdragon@^0.12.0