Socket
Socket
Sign inDemoInstall

anymatch

Package Overview
Dependencies
37
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

LICENSE

22

index.js
'use strict';
var minimatch = require('minimatch');
var micromatch = require('micromatch');
var arrify = require('arrify');
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
if (!Array.isArray(criteria)) { criteria = [criteria]; }
if (arguments.length === 1) { return anymatch.bind(null, criteria); }
var string = Array.isArray(value) ? value[0] : value;
if (!startIndex) { startIndex = 0; }
criteria = arrify(criteria);
value = arrify(value);
if (arguments.length === 1) {
return criteria.length === 1 ?
micromatch.matcher(criteria[0]) :
anymatch.bind(null, criteria.map(function(criterion) {
return micromatch.matcher(criterion);
}));
}
startIndex = startIndex || 0;
var string = value[0];
var matchIndex = -1;

@@ -15,3 +23,3 @@ function testCriteria (criterion, index) {

case '[object String]':
result = string === criterion || minimatch(string, criterion);
result = string === criterion || micromatch.isMatch(string, criterion);
break;

@@ -22,3 +30,3 @@ case '[object RegExp]':

case '[object Function]':
result = criterion.apply(null, Array.isArray(value) ? value : [value]);
result = criterion.apply(null, value);
break;

@@ -25,0 +33,0 @@ default:

{
"name": "anymatch",
"version": "1.1.0",
"version": "1.2.0",
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",

@@ -40,3 +40,4 @@ "main": "index.js",

"dependencies": {
"minimatch": "~1.0.0"
"arrify": "^1.0.0",
"micromatch": "^2.1.0"
},

@@ -43,0 +44,0 @@ "devDependencies": {

@@ -82,4 +82,11 @@ anymatch [![Build Status](https://travis-ci.org/es128/anymatch.svg)](https://travis-ci.org/es128/anymatch) [![Coverage Status](https://img.shields.io/coveralls/es128/anymatch.svg)](https://coveralls.io/r/es128/anymatch?branch=master)

NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
for glob pattern matching. The glob matching behavior should be functionally
equivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch)
library (aside from some fixed bugs and greater performance), so a major
version bump wasn't merited. Issues with glob pattern matching should be
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
License
-------
[ISC](https://raw.github.com/es128/anymatch/master/LICENSE)
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