Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
matcher-collection
Advanced tools
The matcher-collection npm package is a utility that allows you to efficiently test if a value matches any of a collection of patterns. It is often used to filter or find items in a list that match certain criteria.
Matching strings against patterns
This feature allows you to create a collection of string patterns and then test if a given string matches any of those patterns. The patterns can include wildcards.
"use strict";
const MatcherCollection = require('matcher-collection');
let matchers = new MatcherCollection(['foo*', 'bar']);
console.log(matchers.match('foobar')); // true
console.log(matchers.match('barbaz')); // true
console.log(matchers.match('qux')); // false
Matching with regular expressions
Matcher-collection can also handle regular expressions, allowing for more complex matching scenarios.
"use strict";
const MatcherCollection = require('matcher-collection');
let matchers = new MatcherCollection([/foo/, 'bar']);
console.log(matchers.match('foobar')); // true
console.log(matchers.match('barbaz')); // true
console.log(matchers.match('quxfoo')); // true
console.log(matchers.match('qux')); // false
Micromatch is a highly optimized wildcard and glob matching library. It is more feature-rich than matcher-collection, supporting a broader range of pattern matching options, including advanced globbing.
Anymatch is a package that allows you to match strings against a mixture of strings, regexes, and functions. It provides a similar functionality to matcher-collection but also allows for matching using custom test functions.
Multimatch extends the capabilities of micromatch by allowing multiple patterns to be matched against multiple strings. It is similar to matcher-collection in that it deals with collections of patterns, but it is built on top of micromatch for more powerful pattern matching.
Minimatch but for collections of minimatcher matchers.
npm install matcher-collection
const MatcherCollection = require('matcher-collection')
let m = new MatcherCollection([
'tests/',
'**/*.js',
]);
m.match('tests/foo.js') // => true
m.match('foo.js') // => false
m.mayContain('tests') // => true
m.mayContain('foo') // => false
FAQs
Minimatch but for collections of minimatcher matchers.
The npm package matcher-collection receives a total of 971,511 weekly downloads. As such, matcher-collection popularity was classified as popular.
We found that matcher-collection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.