diff options
Diffstat (limited to 'node_modules/nanomatch')
19 files changed, 489 insertions, 715 deletions
diff --git a/node_modules/nanomatch/LICENSE b/node_modules/nanomatch/LICENSE index 717ee8b55..7c9987bc6 100644 --- a/node_modules/nanomatch/LICENSE +++ b/node_modules/nanomatch/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2017, Jon Schlinkert. +Copyright (c) 2016-2018, Jon Schlinkert. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/nanomatch/README.md b/node_modules/nanomatch/README.md index f6ada2fbf..bdd35a94a 100644 --- a/node_modules/nanomatch/README.md +++ b/node_modules/nanomatch/README.md @@ -31,6 +31,8 @@ Please consider following this project's author, [Jon Schlinkert](https://github * [options.nonegate](#optionsnonegate) * [options.nonull](#optionsnonull) * [options.nullglob](#optionsnullglob) + * [options.slash](#optionsslash) + * [options.star](#optionsstar) * [options.snapdragon](#optionssnapdragon) * [options.sourcemap](#optionssourcemap) * [options.unescape](#optionsunescape) @@ -39,7 +41,7 @@ Please consider following this project's author, [Jon Schlinkert](https://github - [Bash expansion libs](#bash-expansion-libs) - [Benchmarks](#benchmarks) * [Running benchmarks](#running-benchmarks) - * [Latest results](#latest-results) + * [Nanomatch vs. Minimatch vs. Multimatch](#nanomatch-vs-minimatch-vs-multimatch) - [About](#about) </details> @@ -536,7 +538,7 @@ console.log(nm.makeRe('*.js')); //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ ``` -### [.create](index.js#L662) +### [.create](index.js#L658) Parses the given glob `pattern` and returns an object with the compiled `output` and optional source `map`. @@ -578,7 +580,7 @@ console.log(nm.create('abc/*.js')); // idx: 6 } ``` -### [.parse](index.js#L701) +### [.parse](index.js#L697) Parse the given `str` with the given `options`. @@ -611,7 +613,7 @@ console.log(ast); // { type: 'eos', val: '' } ] } ``` -### [.compile](index.js#L749) +### [.compile](index.js#L745) Compile the given `ast` or string with the given `options`. @@ -645,7 +647,7 @@ console.log(nm.compile(ast)); // parsingErrors: [] } ``` -### [.clearCache](index.js#L772) +### [.clearCache](index.js#L768) Clear the regex cache. @@ -664,7 +666,7 @@ nm.clearCache(); Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. -Type: `Boolean` +Type: `boolean` Default: `false` @@ -687,7 +689,7 @@ nm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true}); Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. Instead, the star is treated the same as an other star. -Type: `Boolean` +Type: `boolean` Default: `true` @@ -710,7 +712,7 @@ console.log(nm(files, '[a-c]*', {bash: false})); Disable regex and function memoization. -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -723,7 +725,7 @@ Default: `undefined` Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `dot`. -Type: `Boolean` +Type: `boolean` Default: `false` @@ -736,7 +738,7 @@ Default: `false` Similar to the `--failglob` behavior in Bash, throws an error when no matches are found. -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -771,7 +773,7 @@ Alias for [options.basename](#options-basename). Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -784,7 +786,7 @@ Default: `undefined` Remove duplicate elements from the result array. -Type: `Boolean` +Type: `boolean` Default: `true` (enabled by default) @@ -809,7 +811,7 @@ nm.match(['a/b/c', 'a/b/c'], '**', {nodupes: false}); Disable matching with globstars (`**`). -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -830,7 +832,7 @@ nm(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**', {noglobstar: true}); Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -852,20 +854,46 @@ Alias for [options.nullglob](#options-nullglob). If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. -Type: `Boolean` +Type: `boolean` Default: `undefined` </details> <details> -<summary><strong>snapdragon</strong></summary> +<summary><strong><a name="slash">slash</a></strong></summary> + +### options.slash + +Customize the slash character(s) to use for matching. + +Type: `string|function` + +Default: `[/\\]` (forward slash and backslash) + +</details> + +<details> +<summary><strong><a name="star">star</a></strong></summary> + +### options.star + +Customize the star character(s) to use for matching. It's not recommended that you modify this unless you have advanced knowledge of the compiler and matching rules. + +Type: `string|function` + +Default: `[^/\\]*?` + +</details> + +<details> +<summary><strong><a name="snapdragon">snapdragon</a></strong></summary> ### options.snapdragon Pass your own instance of [snapdragon](https://github.com/jonschlinkert/snapdragon) to customize parsers or compilers. -Type: `Object` +Type: `object` Default: `undefined` @@ -910,7 +938,7 @@ console.log(res.map); Remove backslashes from returned matches. -Type: `Boolean` +Type: `boolean` Default: `undefined` @@ -935,7 +963,7 @@ nm.match(['abc', 'a\\*c'], 'a\\*c', {unescape: true}); Convert path separators on returned files to posix/unix-style forward slashes. -Type: `Boolean` +Type: `boolean` Default: `true` @@ -1004,50 +1032,50 @@ Install dev dependencies: npm i -d && node benchmark ``` -### Latest results +### Nanomatch vs. Minimatch vs. Multimatch ```bash # globstar-basic (182 bytes) - minimatch x 70,508 ops/sec ±0.44% (92 runs sampled) - multimatch x 63,220 ops/sec ±0.76% (94 runs sampled) - nanomatch x 377,146 ops/sec ±0.45% (89 runs sampled) + minimatch x 69,512 ops/sec ±1.92% (88 runs sampled) + multimatch x 63,376 ops/sec ±1.41% (89 runs sampled) + nanomatch x 432,451 ops/sec ±0.92% (88 runs sampled) - fastest is nanomatch (by 564% avg) + fastest is nanomatch (by 651% avg) # large-list-globstar (485686 bytes) - minimatch x 35.67 ops/sec ±0.47% (61 runs sampled) - multimatch x 34.80 ops/sec ±1.77% (60 runs sampled) - nanomatch x 509 ops/sec ±0.43% (90 runs sampled) + minimatch x 34.02 ops/sec ±1.42% (59 runs sampled) + multimatch x 33.58 ops/sec ±1.97% (58 runs sampled) + nanomatch x 483 ops/sec ±1.06% (86 runs sampled) - fastest is nanomatch (by 1445% avg) + fastest is nanomatch (by 1429% avg) # long-list-globstar (194085 bytes) - minimatch x 397 ops/sec ±0.96% (89 runs sampled) - multimatch x 400 ops/sec ±0.32% (90 runs sampled) - nanomatch x 843 ops/sec ±0.40% (92 runs sampled) + minimatch x 383 ops/sec ±0.74% (90 runs sampled) + multimatch x 378 ops/sec ±0.59% (89 runs sampled) + nanomatch x 990 ops/sec ±1.14% (85 runs sampled) - fastest is nanomatch (by 212% avg) + fastest is nanomatch (by 260% avg) # negation-basic (132 bytes) - minimatch x 224,342 ops/sec ±1.07% (90 runs sampled) - multimatch x 68,071 ops/sec ±0.80% (89 runs sampled) - nanomatch x 442,204 ops/sec ±1.09% (91 runs sampled) + minimatch x 242,145 ops/sec ±1.17% (89 runs sampled) + multimatch x 76,403 ops/sec ±0.78% (92 runs sampled) + nanomatch x 537,253 ops/sec ±1.44% (86 runs sampled) - fastest is nanomatch (by 302% avg) + fastest is nanomatch (by 337% avg) # not-glob-basic (93 bytes) - minimatch x 222,156 ops/sec ±0.98% (89 runs sampled) - multimatch x 179,724 ops/sec ±1.04% (91 runs sampled) - nanomatch x 1,446,098 ops/sec ±0.45% (92 runs sampled) + minimatch x 252,402 ops/sec ±1.33% (89 runs sampled) + multimatch x 209,954 ops/sec ±1.30% (90 runs sampled) + nanomatch x 1,716,468 ops/sec ±1.13% (86 runs sampled) - fastest is nanomatch (by 720% avg) + fastest is nanomatch (by 742% avg) # star-basic (93 bytes) - minimatch x 165,049 ops/sec ±1.22% (91 runs sampled) - multimatch x 132,553 ops/sec ±0.57% (90 runs sampled) - nanomatch x 522,080 ops/sec ±1.20% (92 runs sampled) + minimatch x 182,780 ops/sec ±1.41% (91 runs sampled) + multimatch x 153,210 ops/sec ±0.72% (89 runs sampled) + nanomatch x 599,621 ops/sec ±1.22% (90 runs sampled) - fastest is nanomatch (by 351% avg) + fastest is nanomatch (by 357% avg) ``` @@ -1099,21 +1127,22 @@ You might also be interested in these projects: | **Commits** | **Contributor** | | --- | --- | -| 144 | [jonschlinkert](https://github.com/jonschlinkert) | +| 164 | [jonschlinkert](https://github.com/jonschlinkert) | | 1 | [devongovett](https://github.com/devongovett) | ### Author **Jon Schlinkert** +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) ### License -Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 20, 2017._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 18, 2018._
\ No newline at end of file diff --git a/node_modules/nanomatch/index.js b/node_modules/nanomatch/index.js index f402d59c9..dddc6128e 100644 --- a/node_modules/nanomatch/index.js +++ b/node_modules/nanomatch/index.js @@ -529,13 +529,12 @@ nanomatch.matcher = function matcher(pattern, options) { }; } - var fn = test(re); - Object.defineProperty(fn, 'result', { - configurable: true, - enumerable: false, - value: re.result - }); - return fn; + // create matcher function + var matcherFn = test(re); + // set result object from compiler on matcher function, + // as a non-enumerable property. useful for debugging + utils.define(matcherFn, 'result', re.result); + return matcherFn; }; /** @@ -608,13 +607,9 @@ nanomatch.makeRe = function(pattern, options) { function makeRe() { var opts = utils.extend({wrap: false}, options); - var res = nanomatch.create(pattern, opts); - var regex = toRegex(res.output, opts); - Object.defineProperty(regex, 'result', { - configurable: true, - enumerable: false, - value: res - }); + var result = nanomatch.create(pattern, opts); + var regex = toRegex(result.output, opts); + utils.define(regex, 'result', result); return regex; } diff --git a/node_modules/nanomatch/lib/.DS_Store b/node_modules/nanomatch/lib/.DS_Store Binary files differdeleted file mode 100644 index 5008ddfcf..000000000 --- a/node_modules/nanomatch/lib/.DS_Store +++ /dev/null diff --git a/node_modules/nanomatch/lib/compilers.js b/node_modules/nanomatch/lib/compilers.js index c2331b287..d7a786e7a 100644 --- a/node_modules/nanomatch/lib/compilers.js +++ b/node_modules/nanomatch/lib/compilers.js @@ -1,11 +1,29 @@ 'use strict'; /** - * Nanomatch compilers - */ +* Nanomatch compilers +*/ module.exports = function(nanomatch, options) { - var star = '[^/]*?'; + function slash() { + if (options && typeof options.slash === 'string') { + return options.slash; + } + if (options && typeof options.slash === 'function') { + return options.slash.call(nanomatch); + } + return '\\\\/'; + } + + function star() { + if (options && typeof options.star === 'string') { + return options.star; + } + if (options && typeof options.star === 'function') { + return options.star.call(nanomatch); + } + return '[^' + slash() + ']*?'; + } var ast = nanomatch.ast = nanomatch.parser.ast; ast.state = nanomatch.parser.state; @@ -15,6 +33,7 @@ module.exports = function(nanomatch, options) { /** * Negation / escaping */ + .set('not', function(node) { var prev = this.prev(); if (this.options.nonegate === true || prev.type !== 'bos') { @@ -23,7 +42,7 @@ module.exports = function(nanomatch, options) { return this.emit(node.val, node); }) .set('escape', function(node) { - if (this.options.unescape && /^[\w_.-]/.test(node.val)) { + if (this.options.unescape && /^[-\w_.]/.test(node.val)) { return this.emit(node.val, node); } return this.emit('\\' + node.val, node); @@ -60,7 +79,7 @@ module.exports = function(nanomatch, options) { return this.emit(node.val, node); }) .set('slash', function(node, nodes, i) { - var val = '\\' + node.val; + var val = '[' + slash() + ']'; var parent = node.parent; var prev = this.prev(); @@ -128,7 +147,7 @@ module.exports = function(nanomatch, options) { */ .set('square', function(node) { - var val = !/^\w/.test(node.val) ? '\\' + node.val : node.val; + var val = (/^\W/.test(node.val) ? '\\' : '') + node.val; return this.emit(val, node); }) @@ -138,6 +157,8 @@ module.exports = function(nanomatch, options) { .set('qmark', function(node) { var prev = this.prev(); + // don't use "slash" variable so that we always avoid + // matching backslashes and slashes with a qmark var val = '[^.\\\\/]'; if (this.options.dot || (prev.type !== 'bos' && prev.type !== 'slash')) { val = '[^\\\\/]'; @@ -184,18 +205,18 @@ module.exports = function(nanomatch, options) { this.state.leadingGlobstar = true; } - var next = this.next(); var prev = this.prev(); - var next2 = this.next(2); - var prev2 = this.prev(2); + var before = this.prev(2); + var next = this.next(); + var after = this.next(2); var type = prev.type; var val = node.val; if (prev.type === 'slash' && next.type === 'slash') { - if (prev2.type === 'text') { + if (before.type === 'text') { this.output += '?'; - if (next2.type !== 'text') { + if (after.type !== 'text') { this.output += '\\b'; } } @@ -206,20 +227,21 @@ module.exports = function(nanomatch, options) { parsed = parsed.slice(1); } - if (parsed && type !== 'slash' && type !== 'bos') { - val = star; + var isInside = node.isInside.paren || node.isInside.brace; + if (parsed && type !== 'slash' && type !== 'bos' && !isInside) { + val = star(); } else { val = this.options.dot !== true - ? '(?:(?!(?:\\/|^)\\.).)*?' - : '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/))(?!\\.{2}).)*?'; + ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?' + : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?'; } if ((type === 'slash' || type === 'bos') && this.options.dot !== true) { val = '(?!\\.)' + val; } - if (prev.type === 'slash' && next.type === 'slash' && prev2.type !== 'text') { - if (next2.type === 'text' || next2.type === 'star') { + if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') { + if (after.type === 'text' || after.type === 'star') { node.addQmark = true; } } @@ -246,23 +268,23 @@ module.exports = function(nanomatch, options) { } if (this.output === '' && this.options.contains !== true) { - this.output = '(?!\\/)'; + this.output = '(?![' + slash() + '])'; } if (type === 'bracket' && this.options.bash === false) { - var str = next && next.type === 'bracket' ? star : '*?'; + var str = next && next.type === 'bracket' ? star() : '*?'; if (!prev.nodes || prev.nodes[1].type !== 'posix') { return this.emit(str, node); } } var prefix = !this.dotfiles && type !== 'text' && type !== 'escape' - ? (this.options.dot ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))' : '(?!\\.)') + ? (this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)') : ''; if (isStart(prev) || (isStart(prior) && type === 'not')) { if (prefix !== '(?!\\.)') { - prefix += '(?!(\\.{2}|\\.\\/))(?=.)'; + prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)'; } else { prefix += '(?=.)'; } @@ -274,7 +296,7 @@ module.exports = function(nanomatch, options) { this.output = '(?!\\.)' + this.output; } - var output = prefix + star; + var output = prefix + star(); if (this.options.capture) { output = '(' + output + ')'; } @@ -298,9 +320,9 @@ module.exports = function(nanomatch, options) { var prev = this.prev(); var val = node.val; - this.output = '(?:(?:\\.(?:\\/|\\\\))(?=.))?' + this.output; + this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output; if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') { - val += (this.options.contains ? '(?:\\/|\\\\)?' : '(?:(?:\\/|\\\\)|$)'); + val += (this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)'); } return this.emit(val, node); diff --git a/node_modules/nanomatch/lib/parsers.js b/node_modules/nanomatch/lib/parsers.js index 0b0a59a59..f87df8f34 100644 --- a/node_modules/nanomatch/lib/parsers.js +++ b/node_modules/nanomatch/lib/parsers.js @@ -2,7 +2,6 @@ var regexNot = require('regex-not'); var toRegex = require('to-regex'); -var isOdd = require('is-odd'); /** * Characters to use in negation regex (we want to "not" match @@ -10,7 +9,7 @@ var isOdd = require('is-odd'); */ var cached; -var NOT_REGEX = '[!*+?$^"\'.\\\\/\\[]+'; +var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+'; var not = createTextRegex(NOT_REGEX); /** @@ -33,12 +32,10 @@ module.exports = function(nanomatch, options) { * Beginning-of-string */ - .capture('bos', function() { + .capture('prefix', function() { if (this.parsed) return; - var pos = this.position(); var m = this.match(/^\.[\\/]/); if (!m) return; - this.state.strictOpen = !!this.options.strictOpen; this.state.addPrefix = true; }) @@ -92,11 +89,11 @@ module.exports = function(nanomatch, options) { .capture('not', function() { var parsed = this.parsed; var pos = this.position(); - var m = this.match(this.notRegex || /^\!+/); + var m = this.match(this.notRegex || /^!+/); if (!m) return; var val = m[0]; - var isNegated = isOdd(val.length); + var isNegated = (val.length % 2) === 1; if (parsed === '' && !isNegated) { val = ''; } @@ -167,16 +164,22 @@ module.exports = function(nanomatch, options) { .capture('globstar', function() { var parsed = this.parsed; var pos = this.position(); - var m = this.match(/^\*{2}(?![*(])(?=[,\/)]|$)/); + var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/); if (!m) return; var type = opts.noglobstar !== true ? 'globstar' : 'star'; var node = pos({type: type, parsed: parsed}); + this.state.metachar = true; - if (this.input.slice(0, 4) === '/**/') { + while (this.input.slice(0, 4) === '/**/') { this.input = this.input.slice(3); } + node.isInside = { + brace: this.isInside('brace'), + paren: this.isInside('paren') + }; + if (type === 'globstar') { this.state.globstar = true; node.val = '**'; @@ -186,7 +189,6 @@ module.exports = function(nanomatch, options) { node.val = '*'; } - this.state.metachar = true; return node; }) @@ -196,7 +198,7 @@ module.exports = function(nanomatch, options) { .capture('star', function() { var pos = this.position(); - var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(\/]|$)|\*(?=\*\())/; + var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/; var m = this.match(starRe); if (!m) return; @@ -269,7 +271,7 @@ module.exports = function(nanomatch, options) { .capture('bracket', function() { var pos = this.position(); - var m = this.match(/^(?:\[([!^]?)([^\]]+|\]\-)(\]|[^*+?]+)|\[)/); + var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/); if (!m) return; var val = m[0]; @@ -373,7 +375,7 @@ function createTextRegex(pattern) { if (cached) return cached; var opts = {contains: true, strictClose: false}; var not = regexNot.create(pattern, opts); - var re = toRegex('^(?:[*]\\(|' + not + ')', opts); + var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts); return (cached = re); } diff --git a/node_modules/nanomatch/lib/utils.js b/node_modules/nanomatch/lib/utils.js index 6fc434012..0cf1501d2 100644 --- a/node_modules/nanomatch/lib/utils.js +++ b/node_modules/nanomatch/lib/utils.js @@ -7,6 +7,7 @@ var path = require('path'); * Module dependencies */ +var isWindows = require('is-windows')(); var Snapdragon = require('snapdragon'); utils.define = require('define-property'); utils.diff = require('arr-diff'); @@ -31,7 +32,7 @@ utils.isEmptyString = function(val) { */ utils.isWindows = function() { - return path.sep === '\\' || process.platform === 'win32'; + return path.sep === '\\' || isWindows === true; }; /** @@ -60,7 +61,7 @@ utils.instantiate = function(ast, options) { } utils.define(snapdragon, 'parse', function(str, options) { - var parsed = Snapdragon.prototype.parse.apply(this, arguments); + var parsed = Snapdragon.prototype.parse.call(this, str, options); parsed.input = str; // escape unmatched brace/bracket/parens @@ -148,21 +149,23 @@ utils.isObject = function(val) { */ utils.escapeRegex = function(str) { - return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&'); + return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&'); }; /** - * Combines duplicate characters in the provided string. - * @param {String} `str` + * Combines duplicate characters in the provided `input` string. + * @param {String} `input` * @returns {String} */ -utils.combineDuplicates = function(str, val) { - if (typeof val === 'string') { - var re = new RegExp('(' + val + ')(?=(?:' + val + ')*\\1)', 'g'); - return str.replace(re, ''); - } - return str.replace(/(.)(?=.*\1)/g, ''); +utils.combineDupes = function(input, patterns) { + patterns = utils.arrayify(patterns).join('|').split('|'); + patterns = patterns.map(function(s) { + return s.replace(/\\?([+*\\/])/g, '\\$1'); + }); + var substr = patterns.join('|'); + var regex = new RegExp('(' + substr + ')(?=\\1)', 'g'); + return input.replace(regex, ''); }; /** @@ -170,7 +173,7 @@ utils.combineDuplicates = function(str, val) { */ utils.hasSpecialChars = function(str) { - return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); + return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str); }; /** @@ -202,7 +205,7 @@ utils.unescape = function(str) { */ utils.stripDrive = function(fp) { - return utils.isWindows() ? fp.replace(/^[a-z]:[\\\/]+?/i, '/') : fp; + return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp; }; /** @@ -226,7 +229,7 @@ utils.stripPrefix = function(str) { */ utils.isSimpleChar = function(str) { - return str === '' || str === ' ' || str === '.'; + return str.trim() === '' || str === '.'; }; /** diff --git a/node_modules/nanomatch/node_modules/define-property/LICENSE b/node_modules/nanomatch/node_modules/define-property/LICENSE index ec85897eb..f8de06305 100644 --- a/node_modules/nanomatch/node_modules/define-property/LICENSE +++ b/node_modules/nanomatch/node_modules/define-property/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015, 2017, Jon Schlinkert +Copyright (c) 2015-2018, Jon Schlinkert. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/nanomatch/node_modules/define-property/README.md b/node_modules/nanomatch/node_modules/define-property/README.md index 2f1af05f3..f1ee8f92e 100644 --- a/node_modules/nanomatch/node_modules/define-property/README.md +++ b/node_modules/nanomatch/node_modules/define-property/README.md @@ -1,6 +1,8 @@ -# define-property [](https://www.npmjs.com/package/define-property) [](https://npmjs.org/package/define-property) [](https://npmjs.org/package/define-property) [](https://travis-ci.org/jonschlinkert/define-property) +# define-property [](https://www.npmjs.com/package/define-property) [](https://npmjs.org/package/define-property) [](https://npmjs.org/package/define-property) [](https://travis-ci.org/jonschlinkert/define-property) -> Define a non-enumerable property on an object. +> Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty. + +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 @@ -10,19 +12,17 @@ Install with [npm](https://www.npmjs.com/): $ npm install --save define-property ``` -Install with [yarn](https://yarnpkg.com): +## Release history -```sh -$ yarn add define-property -``` +See [the CHANGELOG](changelog.md) for updates. ## Usage **Params** -* `obj`: The object on which to define the property. -* `prop`: The name of the property to be defined or modified. -* `descriptor`: The descriptor for the property being defined or modified. +* `object`: The object on which to define the property. +* `key`: The name of the property to be defined or modified. +* `value`: The value or descriptor of the property being defined or modified. ```js var define = require('define-property'); @@ -31,6 +31,7 @@ define(obj, 'foo', function(val) { return val.toUpperCase(); }); +// by default, defined properties are non-enumberable console.log(obj); //=> {} @@ -38,29 +39,39 @@ console.log(obj.foo('bar')); //=> 'BAR' ``` -**get/set** +**defining setters/getters** + +Pass the same properties you would if using [Object.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) or [Reflect.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty). ```js define(obj, 'foo', { - get: function() {}, - set: function() {} + set: function() {}, + get: function() {} }); ``` ## About -### Related projects +<details> +<summary><strong>Contributing</strong></summary> -* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.") -* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") -* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") -* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). -### Contributing +</details> -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). +<details> +<summary><strong>Running Tests</strong></summary> + +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: + +```sh +$ npm install && npm test +``` -### Building docs +</details> + +<details> +<summary><strong>Building docs</strong></summary> _(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.)_ @@ -70,26 +81,37 @@ To generate the readme, run the following command: $ npm install -g verbose/verb#dev verb-generate-readme && verb ``` -### Running tests +</details> -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: +### Related projects -```sh -$ npm install && npm test -``` +You might also be interested in these projects: + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.") +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 28 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | ### Author **Jon Schlinkert** -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) +* Connect with me on [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* Follow me on [github/jonschlinkert](https://github.com/jonschlinkert) +* Follow me on [twitter/jonschlinkert](https://twitter.com/jonschlinkert) ### License -Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on January 25, 2018._
\ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/define-property/index.js b/node_modules/nanomatch/node_modules/define-property/index.js index 27c19ebf6..0efa0a9e6 100644 --- a/node_modules/nanomatch/node_modules/define-property/index.js +++ b/node_modules/nanomatch/node_modules/define-property/index.js @@ -1,31 +1,38 @@ /*! * define-property <https://github.com/jonschlinkert/define-property> * - * Copyright (c) 2015, 2017, Jon Schlinkert. + * Copyright (c) 2015-2018, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; +var isobject = require('isobject'); var isDescriptor = require('is-descriptor'); +var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) + ? Reflect.defineProperty + : Object.defineProperty; -module.exports = function defineProperty(obj, prop, val) { - if (typeof obj !== 'object' && typeof obj !== 'function') { - throw new TypeError('expected an object or function.'); +module.exports = function defineProperty(obj, key, val) { + if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) { + throw new TypeError('expected an object, function, or array'); } - if (typeof prop !== 'string') { - throw new TypeError('expected `prop` to be a string.'); + if (typeof key !== 'string') { + throw new TypeError('expected "key" to be a string'); } - if (isDescriptor(val) && ('set' in val || 'get' in val)) { - return Object.defineProperty(obj, prop, val); + if (isDescriptor(val)) { + define(obj, key, val); + return obj; } - return Object.defineProperty(obj, prop, { + define(obj, key, { configurable: true, enumerable: false, writable: true, value: val }); + + return obj; }; diff --git a/node_modules/nanomatch/node_modules/define-property/package.json b/node_modules/nanomatch/node_modules/define-property/package.json index e0ab1ca00..f8fd21cbc 100644 --- a/node_modules/nanomatch/node_modules/define-property/package.json +++ b/node_modules/nanomatch/node_modules/define-property/package.json @@ -1,9 +1,13 @@ { "name": "define-property", - "description": "Define a non-enumerable property on an object.", - "version": "1.0.0", + "description": "Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty.", + "version": "2.0.2", "homepage": "https://github.com/jonschlinkert/define-property", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], "repository": "jonschlinkert/define-property", "bugs": { "url": "https://github.com/jonschlinkert/define-property/issues" @@ -20,11 +24,12 @@ "test": "mocha" }, "dependencies": { - "is-descriptor": "^1.0.0" + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" }, "devDependencies": { - "gulp-format-md": "^0.1.12", - "mocha": "^3.2.0" + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" }, "keywords": [ "define", @@ -39,14 +44,6 @@ "value" ], "verb": { - "related": { - "list": [ - "extend-shallow", - "merge-deep", - "assign-deep", - "mixin-deep" - ] - }, "toc": false, "layout": "default", "tasks": [ @@ -55,6 +52,14 @@ "plugins": [ "gulp-format-md" ], + "related": { + "list": [ + "assign-deep", + "extend-shallow", + "merge-deep", + "mixin-deep" + ] + }, "lint": { "reflinks": true } diff --git a/node_modules/nanomatch/node_modules/is-descriptor/LICENSE b/node_modules/nanomatch/node_modules/is-descriptor/LICENSE deleted file mode 100644 index c0d7f1362..000000000 --- a/node_modules/nanomatch/node_modules/is-descriptor/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2017, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.
\ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/is-descriptor/README.md b/node_modules/nanomatch/node_modules/is-descriptor/README.md deleted file mode 100644 index 658e53301..000000000 --- a/node_modules/nanomatch/node_modules/is-descriptor/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# is-descriptor [](https://www.npmjs.com/package/is-descriptor) [](https://npmjs.org/package/is-descriptor) [](https://npmjs.org/package/is-descriptor) [](https://travis-ci.org/jonschlinkert/is-descriptor) - -> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-descriptor -``` - -## Usage - -```js -var isDescriptor = require('is-descriptor'); - -isDescriptor({value: 'foo'}) -//=> true -isDescriptor({get: function(){}, set: function(){}}) -//=> true -isDescriptor({get: 'foo', set: function(){}}) -//=> false -``` - -You may also check for a descriptor by passing an object as the first argument and property name (`string`) as the second argument. - -```js -var obj = {}; -obj.foo = 'abc'; - -Object.defineProperty(obj, 'bar', { - value: 'xyz' -}); - -isDescriptor(obj, 'foo'); -//=> true -isDescriptor(obj, 'bar'); -//=> true -``` - -## Examples - -### value type - -`false` when not an object - -```js -isDescriptor('a'); -//=> false -isDescriptor(null); -//=> false -isDescriptor([]); -//=> false -``` - -### data descriptor - -`true` when the object has valid properties with valid values. - -```js -isDescriptor({value: 'foo'}); -//=> true -isDescriptor({value: noop}); -//=> true -``` - -`false` when the object has invalid properties - -```js -isDescriptor({value: 'foo', bar: 'baz'}); -//=> false -isDescriptor({value: 'foo', bar: 'baz'}); -//=> false -isDescriptor({value: 'foo', get: noop}); -//=> false -isDescriptor({get: noop, value: noop}); -//=> false -``` - -`false` when a value is not the correct type - -```js -isDescriptor({value: 'foo', enumerable: 'foo'}); -//=> false -isDescriptor({value: 'foo', configurable: 'foo'}); -//=> false -isDescriptor({value: 'foo', writable: 'foo'}); -//=> false -``` - -### accessor descriptor - -`true` when the object has valid properties with valid values. - -```js -isDescriptor({get: noop, set: noop}); -//=> true -isDescriptor({get: noop}); -//=> true -isDescriptor({set: noop}); -//=> true -``` - -`false` when the object has invalid properties - -```js -isDescriptor({get: noop, set: noop, bar: 'baz'}); -//=> false -isDescriptor({get: noop, writable: true}); -//=> false -isDescriptor({get: noop, value: true}); -//=> false -``` - -`false` when an accessor is not a function - -```js -isDescriptor({get: noop, set: 'baz'}); -//=> false -isDescriptor({get: 'foo', set: noop}); -//=> false -isDescriptor({get: 'foo', bar: 'baz'}); -//=> false -isDescriptor({get: 'foo', set: 'baz'}); -//=> false -``` - -`false` when a value is not the correct type - -```js -isDescriptor({get: noop, set: noop, enumerable: 'foo'}); -//=> false -isDescriptor({set: noop, configurable: 'foo'}); -//=> false -isDescriptor({get: noop, configurable: 'foo'}); -//=> false -``` - -## About - -### Related projects - -* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.") -* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.") -* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.") -* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 24 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [doowb](https://github.com/doowb) | -| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | - -### Building docs - -_(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.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -### Running tests - -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: - -```sh -$ npm install && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._
\ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/is-descriptor/index.js b/node_modules/nanomatch/node_modules/is-descriptor/index.js deleted file mode 100644 index c9b91d762..000000000 --- a/node_modules/nanomatch/node_modules/is-descriptor/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * is-descriptor <https://github.com/jonschlinkert/is-descriptor> - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -var typeOf = require('kind-of'); -var isAccessor = require('is-accessor-descriptor'); -var isData = require('is-data-descriptor'); - -module.exports = function isDescriptor(obj, key) { - if (typeOf(obj) !== 'object') { - return false; - } - if ('get' in obj) { - return isAccessor(obj, key); - } - return isData(obj, key); -}; diff --git a/node_modules/nanomatch/node_modules/is-descriptor/package.json b/node_modules/nanomatch/node_modules/is-descriptor/package.json deleted file mode 100644 index 484a3cc02..000000000 --- a/node_modules/nanomatch/node_modules/is-descriptor/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "is-descriptor", - "description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.", - "version": "1.0.1", - "homepage": "https://github.com/jonschlinkert/is-descriptor", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "(https://github.com/wtgtybhertgeghgtwtg)" - ], - "repository": "jonschlinkert/is-descriptor", - "bugs": { - "url": "https://github.com/jonschlinkert/is-descriptor/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "devDependencies": { - "gulp-format-md": "^1.0.0", - "mocha": "^3.4.2" - }, - "keywords": [ - "accessor", - "check", - "data", - "descriptor", - "get", - "getter", - "is", - "keys", - "object", - "properties", - "property", - "set", - "setter", - "type", - "valid", - "value" - ], - "verb": { - "related": { - "list": [ - "is-accessor-descriptor", - "is-data-descriptor", - "is-descriptor", - "isobject" - ] - }, - "plugins": [ - "gulp-format-md" - ], - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/nanomatch/node_modules/kind-of/README.md b/node_modules/nanomatch/node_modules/kind-of/README.md index 170bf3049..4b0d4a818 100644 --- a/node_modules/nanomatch/node_modules/kind-of/README.md +++ b/node_modules/nanomatch/node_modules/kind-of/README.md @@ -25,7 +25,7 @@ $ bower install kind-of --save ## Usage -> es5, browser and es6 ready +> es5, es6, and browser ready ```js var kindOf = require('kind-of'); @@ -42,24 +42,15 @@ kindOf(true); kindOf(false); //=> 'boolean' -kindOf(new Boolean(true)); -//=> 'boolean' - kindOf(new Buffer('')); //=> 'buffer' kindOf(42); //=> 'number' -kindOf(new Number(42)); -//=> 'number' - kindOf('str'); //=> 'string' -kindOf(new String('str')); -//=> 'string' - kindOf(arguments); //=> 'arguments' @@ -75,29 +66,26 @@ kindOf(new Test()); kindOf(new Date()); //=> 'date' -kindOf([]); -//=> 'array' - kindOf([1, 2, 3]); //=> 'array' -kindOf(new Array()); -//=> 'array' - kindOf(/foo/); //=> 'regexp' kindOf(new RegExp('foo')); //=> 'regexp' +kindOf(new Error('error')); +//=> 'error' + kindOf(function () {}); //=> 'function' kindOf(function * () {}); -//=> 'function' +//=> 'generatorfunction' -kindOf(new Function()); -//=> 'function' +kindOf(Symbol('str')); +//=> 'symbol' kindOf(new Map()); //=> 'map' @@ -111,9 +99,6 @@ kindOf(new Set()); kindOf(new WeakSet()); //=> 'weakset' -kindOf(Symbol('str')); -//=> 'symbol' - kindOf(new Int8Array()); //=> 'int8array' @@ -142,79 +127,115 @@ kindOf(new Float64Array()); //=> 'float64array' ``` -## Release history +## Benchmarks -### v4.0.0 +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). -**Added** +```bash +# arguments (32 bytes) + kind-of x 17,024,098 ops/sec ±1.90% (86 runs sampled) + lib-type-of x 11,926,235 ops/sec ±1.34% (83 runs sampled) + lib-typeof x 9,245,257 ops/sec ±1.22% (87 runs sampled) -* `promise` support + fastest is kind-of (by 161% avg) -### v5.0.0 +# array (22 bytes) + kind-of x 17,196,492 ops/sec ±1.07% (88 runs sampled) + lib-type-of x 8,838,283 ops/sec ±1.02% (87 runs sampled) + lib-typeof x 8,677,848 ops/sec ±0.87% (87 runs sampled) -**Added** + fastest is kind-of (by 196% avg) -* `Set Iterator` and `Map Iterator` support +# boolean (24 bytes) + kind-of x 16,841,600 ops/sec ±1.10% (86 runs sampled) + lib-type-of x 8,096,787 ops/sec ±0.95% (87 runs sampled) + lib-typeof x 8,423,345 ops/sec ±1.15% (86 runs sampled) -**Fixed** + fastest is kind-of (by 204% avg) -* Now returns `generatorfunction` for generator functions +# buffer (38 bytes) + kind-of x 14,848,060 ops/sec ±1.05% (86 runs sampled) + lib-type-of x 3,671,577 ops/sec ±1.49% (87 runs sampled) + lib-typeof x 8,360,236 ops/sec ±1.24% (86 runs sampled) -## Benchmarks + fastest is kind-of (by 247% avg) -Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). -Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. +# date (30 bytes) + kind-of x 16,067,761 ops/sec ±1.58% (86 runs sampled) + lib-type-of x 8,954,436 ops/sec ±1.40% (87 runs sampled) + lib-typeof x 8,488,307 ops/sec ±1.51% (84 runs sampled) -```bash -#1: array - current x 23,329,397 ops/sec ±0.82% (94 runs sampled) - lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) - lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) - -#2: boolean - current x 27,197,115 ops/sec ±0.85% (94 runs sampled) - lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) - lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) - -#3: date - current x 20,190,117 ops/sec ±0.86% (92 runs sampled) - lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) - lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) - -#4: function - current x 23,855,460 ops/sec ±0.60% (97 runs sampled) - lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) - lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) - -#5: null - current x 27,061,047 ops/sec ±0.97% (96 runs sampled) - lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) - lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) - -#6: number - current x 25,075,682 ops/sec ±0.53% (99 runs sampled) - lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) - lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) - -#7: object - current x 3,348,980 ops/sec ±0.49% (99 runs sampled) - lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) - lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) - -#8: regex - current x 21,284,827 ops/sec ±0.72% (96 runs sampled) - lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) - lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) - -#9: string - current x 25,379,234 ops/sec ±0.58% (96 runs sampled) - lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) - lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) - -#10: undef - current x 27,459,221 ops/sec ±1.01% (93 runs sampled) - lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) - lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + fastest is kind-of (by 184% avg) + +# error (36 bytes) + kind-of x 9,634,090 ops/sec ±1.12% (89 runs sampled) + lib-type-of x 7,735,624 ops/sec ±1.32% (86 runs sampled) + lib-typeof x 7,442,160 ops/sec ±1.11% (90 runs sampled) + + fastest is kind-of (by 127% avg) + +# function (34 bytes) + kind-of x 10,031,494 ops/sec ±1.27% (86 runs sampled) + lib-type-of x 9,502,757 ops/sec ±1.17% (89 runs sampled) + lib-typeof x 8,278,985 ops/sec ±1.08% (88 runs sampled) + + fastest is kind-of (by 113% avg) + +# null (24 bytes) + kind-of x 18,159,808 ops/sec ±1.92% (86 runs sampled) + lib-type-of x 12,927,635 ops/sec ±1.01% (88 runs sampled) + lib-typeof x 7,958,234 ops/sec ±1.21% (89 runs sampled) + + fastest is kind-of (by 174% avg) + +# number (22 bytes) + kind-of x 17,846,779 ops/sec ±0.91% (85 runs sampled) + lib-type-of x 3,316,636 ops/sec ±1.19% (86 runs sampled) + lib-typeof x 2,329,477 ops/sec ±2.21% (85 runs sampled) + + fastest is kind-of (by 632% avg) + +# object-plain (47 bytes) + kind-of x 7,085,155 ops/sec ±1.05% (88 runs sampled) + lib-type-of x 8,870,930 ops/sec ±1.06% (83 runs sampled) + lib-typeof x 8,716,024 ops/sec ±1.05% (87 runs sampled) + + fastest is lib-type-of (by 112% avg) + +# regex (25 bytes) + kind-of x 14,196,052 ops/sec ±1.65% (84 runs sampled) + lib-type-of x 9,554,164 ops/sec ±1.25% (88 runs sampled) + lib-typeof x 8,359,691 ops/sec ±1.07% (87 runs sampled) + + fastest is kind-of (by 158% avg) + +# string (33 bytes) + kind-of x 16,131,428 ops/sec ±1.41% (85 runs sampled) + lib-type-of x 7,273,172 ops/sec ±1.05% (87 runs sampled) + lib-typeof x 7,382,635 ops/sec ±1.17% (85 runs sampled) + + fastest is kind-of (by 220% avg) + +# symbol (34 bytes) + kind-of x 17,011,537 ops/sec ±1.24% (86 runs sampled) + lib-type-of x 3,492,454 ops/sec ±1.23% (89 runs sampled) + lib-typeof x 7,471,235 ops/sec ±2.48% (87 runs sampled) + + fastest is kind-of (by 310% avg) + +# template-strings (36 bytes) + kind-of x 15,434,250 ops/sec ±1.46% (83 runs sampled) + lib-type-of x 7,157,907 ops/sec ±0.97% (87 runs sampled) + lib-typeof x 7,517,986 ops/sec ±0.92% (86 runs sampled) + + fastest is kind-of (by 210% avg) + +# undefined (29 bytes) + kind-of x 19,167,115 ops/sec ±1.71% (87 runs sampled) + lib-type-of x 15,477,740 ops/sec ±1.63% (85 runs sampled) + lib-typeof x 19,075,495 ops/sec ±1.17% (83 runs sampled) + + fastest is lib-typeof,kind-of ``` @@ -229,11 +250,11 @@ In 7 out of 8 cases, this library is 2x-10x faster than other top libraries incl ## Better type checking -kind-of is more correct than other type checking libs I've looked at. For example, here are some differing results from other popular libs: +kind-of seems to be more consistently "correct" than other type checking libs I've looked at. For example, here are some differing results from other popular libs: ### [typeof](https://github.com/CodingFu/typeof) lib -Incorrectly tests instances of custom constructors (pretty common): +Incorrectly identifies instances of custom constructors (pretty common): ```js var typeOf = require('typeof'); @@ -278,7 +299,7 @@ console.log(typeOf(new WeakSet())); Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). -<details> +</details> <details> <summary><strong>Running Tests</strong></summary> @@ -289,7 +310,7 @@ Running and reviewing unit tests is a great way to get familiarized with a libra $ npm install && npm test ``` -<details> +</details> <details> <summary><strong>Building docs</strong></summary> @@ -302,7 +323,7 @@ To generate the readme, run the following command: $ npm install -g verbose/verb#dev verb-generate-readme && verb ``` -<details> +</details> ### Related projects @@ -316,19 +337,21 @@ You might also be interested in these projects: | **Commits** | **Contributor** | | --- | --- | -| 82 | [jonschlinkert](https://github.com/jonschlinkert) | +| 98 | [jonschlinkert](https://github.com/jonschlinkert) | | 3 | [aretecode](https://github.com/aretecode) | | 2 | [miguelmota](https://github.com/miguelmota) | | 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ianstormtaylor](https://github.com/ianstormtaylor) | | 1 | [ksheedlo](https://github.com/ksheedlo) | | 1 | [pdehaan](https://github.com/pdehaan) | | 1 | [laggingreflex](https://github.com/laggingreflex) | -| 1 | [charlike](https://github.com/charlike) | +| 1 | [charlike-old](https://github.com/charlike-old) | ### Author **Jon Schlinkert** +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) @@ -339,4 +362,4 @@ Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 13, 2017._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 01, 2017._
\ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/kind-of/index.js b/node_modules/nanomatch/node_modules/kind-of/index.js index fc5cde96e..aa2bb3944 100644 --- a/node_modules/nanomatch/node_modules/kind-of/index.js +++ b/node_modules/nanomatch/node_modules/kind-of/index.js @@ -1,147 +1,129 @@ var toString = Object.prototype.toString; -/** - * Get the native `typeof` a value. - * - * @param {*} `val` - * @return {*} Native javascript type - */ - module.exports = function kindOf(val) { - var type = typeof val; + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; - // primitivies - if (type === 'undefined') { - return 'undefined'; - } - if (val === null) { - return 'null'; - } - if (val === true || val === false || val instanceof Boolean) { - return 'boolean'; - } - if (type === 'string' || val instanceof String) { - return 'string'; - } - if (type === 'number' || val instanceof Number) { - return 'number'; + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; } - // functions - if (type === 'function' || val instanceof Function) { - if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') { - return 'generatorfunction'; - } - return 'function'; - } + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; - // array - if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { - return 'array'; - } + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; - // check for instances of RegExp and Date before calling `toString` - if (val instanceof RegExp) { - return 'regexp'; - } - if (val instanceof Date) { - return 'date'; - } + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; - // other objects - type = toString.call(val); + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; - if (type === '[object RegExp]') { - return 'regexp'; - } - if (type === '[object Date]') { - return 'date'; - } - if (type === '[object Arguments]') { - return 'arguments'; - } - if (type === '[object Error]') { - return 'error'; - } - if (type === '[object Promise]') { - return 'promise'; - } + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; - // buffer - if (isBuffer(val)) { - return 'buffer'; + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; } - // es6: Map, WeakMap, Set, WeakSet - if (type === '[object Set]') { - return 'set'; - } - if (type === '[object WeakSet]') { - return 'weakset'; - } - if (type === '[object Map]') { - return 'map'; - } - if (type === '[object WeakMap]') { - return 'weakmap'; - } - if (type === '[object Symbol]') { - return 'symbol'; - } - - if (type === '[object Map Iterator]') { - return 'mapiterator'; - } - if (type === '[object Set Iterator]') { - return 'setiterator'; - } - if (type === '[object String Iterator]') { - return 'stringiterator'; - } - if (type === '[object Array Iterator]') { - return 'arrayiterator'; - } - - // typed arrays - if (type === '[object Int8Array]') { - return 'int8array'; + if (isGeneratorObj(val)) { + return 'generator'; } - if (type === '[object Uint8Array]') { - return 'uint8array'; - } - if (type === '[object Uint8ClampedArray]') { - return 'uint8clampedarray'; - } - if (type === '[object Int16Array]') { - return 'int16array'; - } - if (type === '[object Uint16Array]') { - return 'uint16array'; - } - if (type === '[object Int32Array]') { - return 'int32array'; - } - if (type === '[object Uint32Array]') { - return 'uint32array'; - } - if (type === '[object Float32Array]') { - return 'float32array'; - } - if (type === '[object Float64Array]') { - return 'float64array'; + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; } - // must be a plain object - return 'object'; + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); }; +function ctorName(val) { + return val.constructor ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + /** * If you need to support Safari 5-7 (8-10 yr-old browser), * take a look at https://github.com/feross/is-buffer */ function isBuffer(val) { - return val.constructor - && typeof val.constructor.isBuffer === 'function' - && val.constructor.isBuffer(val); + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; } diff --git a/node_modules/nanomatch/node_modules/kind-of/package.json b/node_modules/nanomatch/node_modules/kind-of/package.json index 334235fb0..73d70aee4 100644 --- a/node_modules/nanomatch/node_modules/kind-of/package.json +++ b/node_modules/nanomatch/node_modules/kind-of/package.json @@ -1,7 +1,7 @@ { "name": "kind-of", "description": "Get the native type of a value.", - "version": "5.1.0", + "version": "6.0.2", "homepage": "https://github.com/jonschlinkert/kind-of", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "contributors": [ @@ -31,14 +31,11 @@ "prepublish": "browserify -o browser.js -e index.js -s index --bare" }, "devDependencies": { - "ansi-bold": "^0.1.1", - "benchmarked": "^1.1.1", + "benchmarked": "^2.0.0", "browserify": "^14.4.0", - "gulp-format-md": "^0.1.12", - "matched": "^0.4.4", - "mocha": "^3.4.2", - "type-of": "^2.0.1", - "typeof": "^1.0.0" + "gulp-format-md": "^1.0.0", + "mocha": "^4.0.1", + "write": "^1.0.3" }, "keywords": [ "arguments", @@ -64,13 +61,6 @@ "types" ], "verb": { - "related": { - "list": [ - "is-glob", - "is-number", - "is-primitive" - ] - }, "toc": false, "layout": "default", "tasks": [ @@ -82,6 +72,13 @@ "lint": { "reflinks": true }, + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, "reflinks": [ "type-of", "typeof", diff --git a/node_modules/nanomatch/package.json b/node_modules/nanomatch/package.json index 523fa0d30..0a85f0aaa 100644 --- a/node_modules/nanomatch/package.json +++ b/node_modules/nanomatch/package.json @@ -1,7 +1,7 @@ { "name": "nanomatch", "description": "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)", - "version": "1.2.6", + "version": "1.2.13", "homepage": "https://github.com/micromatch/nanomatch", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "contributors": [ @@ -27,11 +27,11 @@ "dependencies": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "extend-shallow": "^2.0.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", "fragment-cache": "^0.2.1", - "is-odd": "^1.0.0", - "kind-of": "^5.0.2", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", "object.pick": "^1.3.0", "regex-not": "^1.0.0", "snapdragon": "^0.8.1", @@ -42,14 +42,12 @@ "for-own": "^1.0.0", "gulp": "^3.9.1", "gulp-format-md": "^1.0.0", - "gulp-istanbul": "^1.1.2", - "gulp-mocha": "^3.0.1", - "gulp-unused": "^0.2.1", + "gulp-istanbul": "^1.1.3", + "gulp-mocha": "^5.0.0", "helper-changelog": "^0.3.0", - "is-windows": "^1.0.1", "minimatch": "^3.0.4", "minimist": "^1.2.0", - "mocha": "^3.5.0", + "mocha": "^3.5.3", "multimatch": "^2.1.0" }, "keywords": [ |