Socket
Socket
Sign inDemoInstall

micromatch

Package Overview
Dependencies
93
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.4.2

2

index.js

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

* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT license.
* Licensed under the MIT License.
*/

@@ -8,0 +8,0 @@

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

* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT license.
* Licensed under the MIT License.
*/

@@ -8,0 +8,0 @@

{
"name": "micromatch",
"description": "Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.",
"version": "1.4.1",
"version": "1.4.2",
"homepage": "https://github.com/jonschlinkert/micromatch",

@@ -10,13 +10,11 @@ "author": {

},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/micromatch.git"
},
"repository": "jonschlinkert/micromatch",
"bugs": {
"url": "https://github.com/jonschlinkert/micromatch/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/micromatch/blob/master/LICENSE"
},
"license": "MIT",
"files": [
"index.js",
"lib/"
],
"main": "index.js",

@@ -31,6 +29,2 @@ "engines": {

},
"files": [
"index.js",
"lib/"
],
"dependencies": {

@@ -86,2 +80,2 @@ "arr-diff": "^1.0.1",

]
}
}

@@ -5,6 +5,6 @@ # micromatch [![NPM version](https://badge.fury.io/js/micromatch.svg)](http://badge.fury.io/js/micromatch) [![Build Status](https://travis-ci.org/jonschlinkert/micromatch.svg)](https://travis-ci.org/jonschlinkert/micromatch)

- 10-45x faster than [minimatch] on average ([see benchmarks](#benchmarks))
- Focus on core Bash 4.3 specification features that are actually used (or can be used) in node.js
- Supports passing glob patterns as a string or array
- Extensive unit tests
- 10-45x faster than [minimatch], ([see benchmarks](#benchmarks))
- Better support for the Bash 4.3 specification, and less buggy
- Works with a single glob or an array of glob patterns
- Extensive [unit tests](./test) (approx. 1,300 tests)

@@ -21,3 +21,3 @@ ## Features

+ Regex character classes (`foo/bar/baz-[1-5].js`)
+ POSIX bracket expressions (`**/[:alpha:][:digit:]/`)
+ POSIX bracket expressions (`**/[[:alpha:][:digit:]]/`)
+ extglobs (`**/+(x|y)`, `!(a|b)`, etc)

@@ -39,3 +39,8 @@

var mm = require('micromatch');
mm(array, patterns);
```
**Examples**
```js
mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}');

@@ -64,40 +69,3 @@ //=> ['a.js', 'c.txt']

## Special characters
> With the exception of brace expansion (`{a,b}`, `{1..5}`, etc), most of the special characters convert directly to regex, so you can expect them to follow the same rules and produce the same results as regex.
**Square brackets**
Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
- `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']`
- `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
- `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
- `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']`
Learn about [regex character classes][character-classes].
**Parentheses**
Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
- `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']`
- `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']`
- `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']`
As with regex, parenthese can be nested, so patterns like `((a|b)|c)/b` will work. But it might be easier to achieve your goal using brace expansion.
**Brace Expansion**
In simple cases, brace expansion appears to work the same way as the logical `OR` operator. For example, `(a|b)` will achieve the same result as `{a,b}`.
Here are some powerful features unique to brace expansion (versus character classes):
- range expansion: `a{1..3}b/*.js` expands to: `['a1b/*.js', 'a2b/*.js', 'a3b/*.js']`
- nesting: `a{c,{d,e}}b/*.js` expands to: `['acb/*.js', 'adb/*.js', 'aeb/*.js']`
Learn about [brace expansion][braces], or visit [braces][braces] to ask questions and create an issue related to brace-expansion, or to see the full range of features and options related to brace expansion.
## Methods

@@ -111,4 +79,9 @@

```js
mm.isMatch(filepath, globPattern);
```
Returns true if a file path matches the given glob pattern.
**Example**

@@ -138,2 +111,20 @@

### .matcher
Returns a function for matching using the supplied pattern. e.g. create your own "matcher". The advantage of this method is that the pattern can be compiled outside of a loop.
**Example**
```js
var isMatch = mm.matcher('*.md');
var files = [];
['a.md', 'b.txt', 'c.md'].forEach(function(fp) {
if (isMatch(fp)) {
files.push(fp);
}
});
```
### .filter

@@ -245,2 +236,41 @@

## Special characters
> With the exception of brace expansion (`{a,b}`, `{1..5}`, etc), most of the special characters convert directly to regex, so you can expect them to follow the same rules and produce the same results as regex.
**Square brackets**
Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
- `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']`
- `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
- `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
- `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']`
Learn about [regex character classes][character-classes].
**Parentheses**
Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
- `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']`
- `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']`
- `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']`
As with regex, parenthese can be nested, so patterns like `((a|b)|c)/b` will work. But it might be easier to achieve your goal using brace expansion.
**Brace Expansion**
In simple cases, brace expansion appears to work the same way as the logical `OR` operator. For example, `(a|b)` will achieve the same result as `{a,b}`.
Here are some powerful features unique to brace expansion (versus character classes):
- range expansion: `a{1..3}b/*.js` expands to: `['a1b/*.js', 'a2b/*.js', 'a3b/*.js']`
- nesting: `a{c,{d,e}}b/*.js` expands to: `['acb/*.js', 'adb/*.js', 'aeb/*.js']`
Learn about [brace expansion][braces], or visit [braces][braces] to ask questions and create an issue related to brace-expansion, or to see the full range of features and options related to brace expansion.
## Benchmarks

@@ -254,3 +284,3 @@

As of February 17, 2015:
As of February 20, 2015:

@@ -338,3 +368,3 @@ ```bash

_This file was generated by [verb](https://github.com/assemble/verb) on February 17, 2015._
_This file was generated by [verb](https://github.com/assemble/verb) on February 20, 2015._

@@ -341,0 +371,0 @@ [extended]: http://mywiki.wooledge.org/BashGuide/Patterns#Extended_Globs

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