Socket
Socket
Sign inDemoInstall

micromatch

Package Overview
Dependencies
34
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.8 to 2.3.9

12

index.js

@@ -70,3 +70,3 @@ /*!

var negate = opts.negate || false;
var negate = !!opts.negate;
var orig = pattern;

@@ -95,4 +95,5 @@

if (!_isMatch(fp)) { continue; }
res.push(fp);
if (_isMatch(fp)) {
res.push(fp);
}
}

@@ -113,3 +114,3 @@

// if `ignore` was defined, diff ignored filed
// if `ignore` was defined, diff ignored files
if (opts.ignore && opts.ignore.length) {

@@ -314,4 +315,3 @@ pattern = opts.ignore;

return function(fp) {
fp = utils.unixify(fp, opts);
return re.test(fp);
return re.test(utils.unixify(fp, opts));
};

@@ -318,0 +318,0 @@ }

@@ -5,3 +5,2 @@ 'use strict';

var path = require('path');
var fileRe = require('filename-regex');
var utils = module.exports;

@@ -13,28 +12,16 @@

utils.diff = require('arr-diff');
utils.unique = require('array-unique');
utils.braces = require('braces');
utils.brackets = require('expand-brackets');
utils.cache = require('regex-cache');
utils.diff = require('arr-diff');
utils.extglob = require('extglob');
utils.isExtglob = require('is-extglob');
utils.isGlob = require('is-glob');
utils.typeOf = require('kind-of');
utils.normalize = require('normalize-path');
utils.omit = require('object.omit');
utils.parseGlob = require('parse-glob');
utils.cache = require('regex-cache');
utils.typeOf = require('kind-of');
utils.unique = require('array-unique');
/**
* Get the filename of a filepath
*
* @param {String} `string`
* @return {String}
*/
utils.filename = function filename(fp) {
var seg = fp.match(fileRe());
return seg && seg[0];
};
/**
* Returns a function that returns true if the given

@@ -47,5 +34,5 @@ * pattern is the same as a given `filepath`

utils.isPath = function isPath(pattern, opts) {
utils.pathEquals = function(pattern, opts) {
return function(fp) {
return pattern === utils.unixify(fp, opts);
return pattern === fp;
};

@@ -62,5 +49,5 @@ };

utils.hasPath = function hasPath(pattern, opts) {
utils.pathContains = function(pattern) {
return function(fp) {
return utils.unixify(pattern, opts).indexOf(fp) !== -1;
return fp.indexOf(pattern) !== -1;
};

@@ -77,7 +64,6 @@ };

utils.matchPath = function matchPath(pattern, opts) {
var fn = (opts && opts.contains)
? utils.hasPath(pattern, opts)
: utils.isPath(pattern, opts);
return fn;
utils.matchPath = function(pattern, opts) {
return (opts && opts.contains)
? utils.pathContains(pattern, opts)
: utils.pathEquals(pattern, opts);
};

@@ -93,5 +79,5 @@

utils.hasFilename = function hasFilename(re) {
utils.hasFilename = function(re) {
return function(fp) {
var name = utils.filename(fp);
var name = path.basename(fp);
return name && re.test(name);

@@ -108,6 +94,4 @@ };

utils.arrayify = function arrayify(val) {
return !Array.isArray(val)
? [val]
: val;
utils.arrayify = function(val) {
return val ? (Array.isArray(val) ? val : [val]) : [];
};

@@ -120,3 +104,3 @@

utils.unixify = function unixify(fp, opts) {
utils.unixify = function(fp, opts) {
if (opts && opts.unixify === false) return fp;

@@ -136,11 +120,11 @@ if (opts && opts.unixify === true || win32 || path.sep === '\\') {

utils.escapePath = function escapePath(fp) {
utils.escapePath = function(fp) {
return fp.replace(/[\\.]/g, '\\$&');
};
utils.unescapeGlob = function unescapeGlob(fp) {
utils.unescapeGlob = function(fp) {
return fp.replace(/[\\"']/g, '');
};
utils.escapeRe = function escapeRe(str) {
utils.escapeRe = function(str) {
return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');

@@ -147,0 +131,0 @@ };

{
"name": "micromatch",
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
"version": "2.3.8",
"version": "2.3.9",
"homepage": "https://github.com/jonschlinkert/micromatch",

@@ -14,3 +14,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"index.js",
"lib/"
"lib"
],

@@ -25,30 +25,29 @@ "main": "index.js",

"dependencies": {
"arr-diff": "^2.0.0",
"arr-diff": "^3.0.0",
"array-unique": "^0.2.1",
"braces": "^1.8.2",
"expand-brackets": "^0.1.4",
"extglob": "^0.3.1",
"filename-regex": "^2.0.0",
"braces": "^1.8.4",
"expand-brackets": "^0.1.5",
"extglob": "^0.3.2",
"is-extglob": "^1.0.0",
"is-glob": "^2.0.1",
"kind-of": "^3.0.2",
"kind-of": "^3.0.3",
"normalize-path": "^2.0.1",
"object.omit": "^2.0.0",
"parse-glob": "^3.0.4",
"regex-cache": "^0.4.2"
"regex-cache": "^0.4.3"
},
"devDependencies": {
"benchmarked": "^0.1.4",
"chalk": "^1.1.1",
"gulp": "^3.9.0",
"gulp-eslint": "^1.1.1",
"gulp-format-md": "^0.1.8",
"gulp-istanbul": "^0.10.1",
"gulp-mocha": "^2.1.3",
"benchmarked": "^0.2.5",
"chalk": "^1.1.3",
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-format-md": "^0.1.9",
"gulp-istanbul": "^0.10.4",
"gulp-mocha": "^2.2.0",
"minimatch": "^3.0.0",
"minimist": "^1.2.0",
"mocha": "^2",
"multimatch": "^2.0.0",
"should": "^8",
"write": "^0.2.1"
"mocha": "^2.4.5",
"multimatch": "^2.1.0",
"should": "^8.3.1",
"write": "^0.3.1"
},

@@ -55,0 +54,0 @@ "keywords": [

@@ -5,7 +5,7 @@ # micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Build Status](https://img.shields.io/travis/jonschlinkert/micromatch.svg?style=flat)](https://travis-ci.org/jonschlinkert/micromatch)

Micromatch supports all of the same matching features as minimatch and micromatch.
Micromatch supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch).
* [mm()](#usage) is the same as [multimatch()](https://github.com/sindresorhus/multimatch)
* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch#readme)
* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch#readme)
* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch)
* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch)

@@ -17,3 +17,3 @@ ## Install

```sh
$ npm install micromatch --save
$ npm install --save micromatch
```

@@ -34,3 +34,3 @@

* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch#readme) and [multimatch](https://github.com/sindresorhus/multimatch)
* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']`

@@ -61,3 +61,3 @@ * [Brace Expansion](https://github.com/jonschlinkert/braces) (`foo/bar-{1..5}.md`, `one/{two,three}/four.md`)

* Native support for multiple glob patterns, no need for wrappers like [multimatch](https://github.com/sindresorhus/multimatch)
* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch#readme) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch.
* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch.
* More extensive support for the Bash 4.3 specification

@@ -149,3 +149,3 @@ * More complete extglob support

* [minimatch](https://github.com/isaacs/minimatch#readme) behavior is used when the pattern is a string, so patterns are **inclusive by default**.
* [minimatch](https://github.com/isaacs/minimatch) behavior is used when the pattern is a string, so patterns are **inclusive by default**.
* [multimatch](https://github.com/sindresorhus/multimatch) behavior is used when an array of patterns is passed, so patterns are **exclusive by default**.

@@ -360,3 +360,3 @@

Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch).

@@ -404,3 +404,3 @@ Type: `{Boolean}`

Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch).

@@ -423,3 +423,3 @@ Type: `{Boolean}`

Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme) `nobrace`.
Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) `nobrace`.

@@ -454,3 +454,3 @@ Type: `{Boolean}`

Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch).

@@ -461,5 +461,13 @@ Type: `{Boolean}`

### options.nonegate
Disallow negation (`!`) patterns.
Type: `{Boolean}`
Default: `false`
### options.nonull
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch#readme).
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch).

@@ -563,56 +571,95 @@ Type: `{Boolean}`

As of April 22, 2016:
As of June 21, 2016:
```bash
#1: basename-braces
micromatch x 26,420 ops/sec ±0.89% (91 runs sampled)
minimatch x 3,507 ops/sec ±0.64% (97 runs sampled)
# benchmark/fixtures/basename-braces.js (12343 bytes)
micromatch x 27,210 ops/sec ±1.23% (87 runs sampled)
minimatch x 3,976 ops/sec ±1.41% (86 runs sampled)
multimatch x 3,818 ops/sec ±1.35% (89 runs sampled)
#2: basename
micromatch x 25,315 ops/sec ±0.82% (93 runs sampled)
minimatch x 4,398 ops/sec ±0.86% (94 runs sampled)
fastest is micromatch
#3: braces-no-glob
micromatch x 341,254 ops/sec ±0.78% (93 runs sampled)
minimatch x 30,197 ops/sec ±1.12% (91 runs sampled)
# benchmark/fixtures/basename.js (12339 bytes)
micromatch x 18,867 ops/sec ±3.96% (73 runs sampled)
minimatch x 4,611 ops/sec ±1.32% (85 runs sampled)
multimatch x 4,667 ops/sec ±1.37% (87 runs sampled)
#4: braces
micromatch x 54,649 ops/sec ±0.74% (94 runs sampled)
minimatch x 3,095 ops/sec ±0.82% (95 runs sampled)
fastest is micromatch
#5: immediate
micromatch x 16,719 ops/sec ±0.79% (95 runs sampled)
minimatch x 4,348 ops/sec ±0.86% (96 runs sampled)
# benchmark/fixtures/braces-no-glob.js (706 bytes)
micromatch x 316,578 ops/sec ±1.00% (87 runs sampled)
minimatch x 31,374 ops/sec ±1.03% (86 runs sampled)
multimatch x 29,461 ops/sec ±1.47% (87 runs sampled)
#6: large
micromatch x 721 ops/sec ±0.77% (94 runs sampled)
minimatch x 17.73 ops/sec ±1.08% (50 runs sampled)
fastest is micromatch
#7: long
micromatch x 5,051 ops/sec ±0.87% (97 runs sampled)
minimatch x 628 ops/sec ±0.83% (94 runs sampled)
# benchmark/fixtures/braces.js (2858 bytes)
micromatch x 61,618 ops/sec ±1.25% (86 runs sampled)
minimatch x 2,947 ops/sec ±1.28% (87 runs sampled)
multimatch x 2,460 ops/sec ±1.23% (87 runs sampled)
#8: mid
micromatch x 51,280 ops/sec ±0.80% (95 runs sampled)
minimatch x 1,923 ops/sec ±0.84% (95 runs sampled)
fastest is micromatch
#9: multi-patterns
micromatch x 22,440 ops/sec ±0.97% (94 runs sampled)
minimatch x 2,481 ops/sec ±1.10% (94 runs sampled)
# benchmark/fixtures/immediate.js (12338 bytes)
micromatch x 19,112 ops/sec ±0.99% (87 runs sampled)
minimatch x 4,551 ops/sec ±1.23% (88 runs sampled)
multimatch x 4,656 ops/sec ±1.31% (88 runs sampled)
#10: no-glob
micromatch x 722,823 ops/sec ±1.30% (87 runs sampled)
minimatch x 52,967 ops/sec ±1.09% (94 runs sampled)
fastest is micromatch
#11: range
micromatch x 243,471 ops/sec ±0.79% (94 runs sampled)
minimatch x 11,736 ops/sec ±0.82% (96 runs sampled)
# benchmark/fixtures/large.js (485691 bytes)
micromatch x 757 ops/sec ±0.99% (86 runs sampled)
minimatch x 20.97 ops/sec ±1.64% (35 runs sampled)
multimatch x 20.78 ops/sec ±1.66% (35 runs sampled)
#12: shallow
micromatch x 190,874 ops/sec ±0.98% (95 runs sampled)
minimatch x 21,699 ops/sec ±0.81% (97 runs sampled)
fastest is micromatch
#13: short
micromatch x 496,393 ops/sec ±3.86% (90 runs sampled)
minimatch x 53,765 ops/sec ±0.75% (95 runs sampled)
# benchmark/fixtures/long.js (90647 bytes)
micromatch x 6,356 ops/sec ±1.02% (86 runs sampled)
minimatch x 619 ops/sec ±1.16% (85 runs sampled)
multimatch x 581 ops/sec ±1.44% (84 runs sampled)
fastest is micromatch
# benchmark/fixtures/mid.js (3258 bytes)
micromatch x 61,002 ops/sec ±1.60% (82 runs sampled)
minimatch x 2,075 ops/sec ±1.15% (87 runs sampled)
multimatch x 1,951 ops/sec ±1.23% (85 runs sampled)
fastest is micromatch
# benchmark/fixtures/multi-patterns.js (2872 bytes)
micromatch x 22,986 ops/sec ±1.16% (88 runs sampled)
minimatch x 2,363 ops/sec ±1.58% (86 runs sampled)
multimatch x 2,380 ops/sec ±1.11% (88 runs sampled)
fastest is micromatch
# benchmark/fixtures/no-glob.js (701 bytes)
micromatch x 908,468 ops/sec ±1.36% (81 runs sampled)
minimatch x 57,417 ops/sec ±1.22% (87 runs sampled)
multimatch x 55,250 ops/sec ±1.29% (88 runs sampled)
fastest is micromatch
# benchmark/fixtures/range.js (727 bytes)
micromatch x 291,205 ops/sec ±1.39% (84 runs sampled)
minimatch x 12,615 ops/sec ±1.08% (87 runs sampled)
multimatch x 13,341 ops/sec ±1.27% (84 runs sampled)
fastest is micromatch
# benchmark/fixtures/shallow.js (701 bytes)
micromatch x 234,602 ops/sec ±1.30% (89 runs sampled)
minimatch x 21,503 ops/sec ±1.48% (85 runs sampled)
multimatch x 23,195 ops/sec ±1.13% (87 runs sampled)
fastest is micromatch
# benchmark/fixtures/short.js (220 bytes)
micromatch x 640,928 ops/sec ±4.81% (84 runs sampled)
minimatch x 66,070 ops/sec ±1.53% (88 runs sampled)
multimatch x 65,086 ops/sec ±1.89% (88 runs sampled)
fastest is micromatch
```

@@ -632,3 +679,3 @@

As of April 22, 2016:
As of June 21, 2016:

@@ -644,3 +691,3 @@ ```sh

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/micromatch/issues/new).
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

@@ -651,14 +698,14 @@ Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks!

* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://www.npmjs.com/package/braces) | [homepage](https://github.com/jonschlinkert/braces)
* [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-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://www.npmjs.com/package/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range)
* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://www.npmjs.com/package/extglob) | [homepage](https://github.com/jonschlinkert/extglob)
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://www.npmjs.com/package/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range)
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch)
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob)
* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.")
* [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. See… [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. See the benchmarks. Used by micromatch.")
* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.")
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier 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 multiplier to use.")
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch#readme "Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream.")
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob "Parse a glob pattern into an object of tokens.")
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/micromatch/issues/new).
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

@@ -670,11 +717,5 @@ ## Building docs

```sh
$ npm install verb && npm run docs
$ npm install -g verb verb-readme-generator && verb
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests

@@ -702,2 +743,2 @@

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 22, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on June 21, 2016._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc