Socket
Socket
Sign inDemoInstall

multimatch

Package Overview
Dependencies
8
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 3.0.0

16

index.js
'use strict';
var minimatch = require('minimatch');
var arrayUnion = require('array-union');
var arrayDiffer = require('array-differ');
var arrify = require('arrify');
const minimatch = require('minimatch');
const arrayUnion = require('array-union');
const arrayDiffer = require('array-differ');
const arrify = require('arrify');
module.exports = function (list, patterns, options) {
module.exports = (list, patterns, options = {}) => {
list = arrify(list);

@@ -15,7 +15,5 @@ patterns = arrify(patterns);

options = options || {};
return patterns.reduce((ret, pattern) => {
let process = arrayUnion;
return patterns.reduce(function (ret, pattern) {
var process = arrayUnion;
if (pattern[0] === '!') {

@@ -22,0 +20,0 @@ pattern = pattern.slice(1);

{
"name": "multimatch",
"version": "2.1.0",
"description": "Extends minimatch.match() with support for multiple patterns",
"license": "MIT",
"repository": "sindresorhus/multimatch",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "http://sindresorhus.com"
},
"maintainers": [
{
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"expand",
"find",
"glob",
"globbing",
"globs",
"match",
"matcher",
"minimatch",
"pattern",
"patterns",
"wildcard"
],
"dependencies": {
"array-differ": "^1.0.0",
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"minimatch": "^3.0.0"
},
"devDependencies": {
"chai": "^3.4.1",
"mocha": "*"
}
"name": "multimatch",
"version": "3.0.0",
"description": "Extends `minimatch.match()` with support for multiple patterns",
"license": "MIT",
"repository": "sindresorhus/multimatch",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"expand",
"find",
"glob",
"globbing",
"globs",
"match",
"matcher",
"minimatch",
"pattern",
"patterns",
"wildcard"
],
"dependencies": {
"array-differ": "^2.0.3",
"array-union": "^1.0.2",
"arrify": "^1.0.1",
"minimatch": "^3.0.4"
},
"devDependencies": {
"ava": "^1.0.1",
"xo": "^0.23.0"
}
}

@@ -8,6 +8,5 @@ # multimatch [![Build Status](https://travis-ci.org/sindresorhus/multimatch.svg?branch=master)](https://travis-ci.org/sindresorhus/multimatch)

```sh
$ npm install --save multimatch
```
$ npm install multimatch
```

@@ -18,3 +17,3 @@

```js
var multimatch = require('multimatch');
const multimatch = require('multimatch');

@@ -25,3 +24,3 @@ multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);

See the [tests](https://github.com/sindresorhus/multimatch/blob/master/test.js) for more usage examples and expected matches.
See the [tests](https://github.com/sindresorhus/multimatch/tree/master/test) for more usage examples and expected matches.

@@ -31,11 +30,26 @@

Same as [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) except for `pattern` also accepting an array.
### multimatch(paths, patterns, [options]
```js
var results = multimatch(paths, patterns);
```
Returns an array of matching paths.
The return value is an array of matching paths.
#### paths
Type: `string` `string[]`
#### patterns
Type: `string` `string[]`
See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage).
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js)
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
#### options
Type: `Object`
See the [`minimatch` options](https://github.com/isaacs/minimatch#options).
## How multiple patterns work

@@ -61,3 +75,4 @@

See [globby](https://github.com/sindresorhus/globby) if you need to match against the filesystem instead of a list.
- [globby](https://github.com/sindresorhus/globby) - Match against the filesystem instead of a list
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching

@@ -67,2 +82,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com), [Jon Schlinkert](https://github.com/jonschlinkert)
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

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