Comparing version 1.1.0 to 1.1.1
16
index.js
@@ -6,3 +6,3 @@ 'use strict'; | ||
function makeRe(pattern, shouldNegate, options) { | ||
function makeRe(pattern, options) { | ||
const opts = Object.assign({ | ||
@@ -12,3 +12,3 @@ caseSensitive: false | ||
const cacheKey = pattern + shouldNegate + JSON.stringify(opts); | ||
const cacheKey = pattern + JSON.stringify(opts); | ||
@@ -27,6 +27,2 @@ if (reCache.has(cacheKey)) { | ||
if (negated && shouldNegate) { | ||
pattern = `(?!${pattern})`; | ||
} | ||
const re = new RegExp(`^${pattern}$`, opts.caseSensitive ? '' : 'i'); | ||
@@ -50,3 +46,3 @@ re.negated = negated; | ||
patterns = patterns.map(x => makeRe(x, false, options)); | ||
patterns = patterns.map(x => makeRe(x, options)); | ||
@@ -73,2 +69,6 @@ const ret = []; | ||
module.exports.isMatch = (input, pattern, options) => makeRe(pattern, true, options).test(input); | ||
module.exports.isMatch = (input, pattern, options) => { | ||
const re = makeRe(pattern, options); | ||
const matches = re.test(input); | ||
return re.negated ? !matches : matches; | ||
}; |
{ | ||
"name": "matcher", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Simple wildcard matching", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50
5277