matcher-collection
Advanced tools
Comparing version 1.0.5 to 1.1.0
63
index.js
'use strict'; | ||
var Minimatch = require('minimatch').Minimatch; | ||
module.exports = MatcherCollection; | ||
function MatcherCollection(matchers) { | ||
this.matchers = matchers.map(function(matcher) { | ||
return typeof matcher === 'string' ? new Minimatch(matcher) : matcher; | ||
}); | ||
} | ||
MatcherCollection.prototype.match = function(value) { | ||
for (var i = 0; i < this.matchers.length; i++) { | ||
if (this.matchers[i].match(value)) { | ||
return true; | ||
var minimatch_1 = require("minimatch"); | ||
module.exports = /** @class */ (function () { | ||
function MatcherCollection(matchers) { | ||
this.matchers = matchers.map(function (matcher) { | ||
return typeof matcher === 'string' ? new minimatch_1.Minimatch(matcher) : matcher; | ||
}); | ||
} | ||
} | ||
return false; | ||
}; | ||
MatcherCollection.prototype.mayContain = function(value) { | ||
var parts = value.split(/\/|\\/g).filter(Boolean); | ||
for (var i = 0; i < this.matchers.length; i++) { | ||
var matcher = this.matchers[i]; | ||
for (var j = 0; j < matcher.set.length; j++) { | ||
if (matcher.matchOne(parts, matcher.set[j], true)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
MatcherCollection.prototype.match = function (value) { | ||
for (var i = 0; i < this.matchers.length; i++) { | ||
if (this.matchers[i].match(value)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
MatcherCollection.prototype.mayContain = function (value) { | ||
var parts = value.split(/\/|\\/g).filter(Boolean); | ||
for (var i = 0; i < this.matchers.length; i++) { | ||
var matcher = this.matchers[i]; | ||
for (var j = 0; j < matcher.set.length; j++) { | ||
if (matcher.matchOne(parts, matcher.set[j], true)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
; | ||
return MatcherCollection; | ||
}()); |
{ | ||
"name": "matcher-collection", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"main": "index.js", | ||
@@ -9,10 +9,15 @@ "dependencies": { | ||
"devDependencies": { | ||
"tap": "^1.4.1" | ||
"@types/minimatch": "^3.0.3", | ||
"@types/node": "^10.12.21", | ||
"tap": "^1.4.1", | ||
"typescript": "~3.3.1" | ||
}, | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"test": "tap --timeout 2 test.js", | ||
"test:debug": "tap --debug-brk --timeout 9999 test.js" | ||
"build": "tsc -b .", | ||
"test": "tsc -b . && tap --timeout 2 test.js", | ||
"test:debug": "tsc -b . && tap --debug-brk --timeout 9999 test.js" | ||
}, | ||
@@ -19,0 +24,0 @@ "author": "Stefan Penner", |
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
2711
4
40
4