Socket
Socket
Sign inDemoInstall

matcher-collection

Package Overview
Dependencies
5
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    matcher-collection

Minimatch but for collections of minimatcher matchers.


Version published
Weekly downloads
1.2M
decreased by-13.5%
Maintainers
1
Install size
70.5 kB
Created
Weekly downloads
 

Package description

What is matcher-collection?

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.

What are matcher-collection's main functionalities?

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

Other packages similar to matcher-collection

Readme

Source

MatcherCollection Build Status Build status

Minimatch but for collections of minimatcher matchers.

Install

yarn add matcher-collection

Examples

const MatcherCollection = require('matcher-collection')

const 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

Last updated on 28 Oct 2019

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.

Install

Related posts

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