Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multimatch

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multimatch - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

license

17

index.js
'use strict';
var minimatch = require('minimatch');
var union = require('array-union');
var diff = require('array-differ');
var arrayUnion = require('array-union');
var arrayDiffer = require('array-differ');
var arrify = require('arrify');
function arrayify(arr) {
return Array.isArray(arr) ? arr : [arr];
}
module.exports = function (list, patterns, options) {
list = arrayify(list);
patterns = arrayify(patterns);
list = arrify(list);
patterns = arrify(patterns);

@@ -21,7 +18,7 @@ if (list.length === 0 || patterns.length === 0) {

return patterns.reduce(function (ret, pattern) {
var process = union;
var process = arrayUnion;
if (pattern[0] === '!') {
pattern = pattern.slice(1);
process = diff;
process = arrayDiffer;
}

@@ -28,0 +25,0 @@

{
"name": "multimatch",
"version": "2.0.0",
"version": "2.1.0",
"description": "Extends minimatch.match() with support for multiple patterns",

@@ -8,4 +8,4 @@ "license": "MIT",

"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"

@@ -29,13 +29,13 @@ },

"keywords": [
"minimatch",
"expand",
"find",
"glob",
"globbing",
"globs",
"match",
"matcher",
"minimatch",
"pattern",
"patterns",
"glob",
"globs",
"globbing",
"expand",
"wildcard",
"find"
"wildcard"
],

@@ -45,8 +45,9 @@ "dependencies": {

"array-union": "^1.0.1",
"minimatch": "^2.0.1"
"arrify": "^1.0.0",
"minimatch": "^3.0.0"
},
"devDependencies": {
"chai": "^1.9.1",
"chai": "^3.4.1",
"mocha": "*"
}
}

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

```js
var results = multimatch(paths, patterns);
```
The return value is an array of matching paths.
## How multiple patterns work
Positive patterns (e.g. `foo` or `*`) add to the results, while negative patterns (e.g. `!foo`) subtract from the results.
Therefore a lone negation (e.g. `['!foo']`) will never match anything – use `['*', '!foo']` instead.
## Globbing patterns

@@ -33,0 +46,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc