Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

matcher

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matcher

Simple wildcard matching

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7M
decreased by-7.38%
Maintainers
1
Weekly downloads
 
Created

What is matcher?

The 'matcher' npm package is a utility for matching strings against patterns. It is useful for filtering arrays of strings, validating input, and more. It supports wildcards and provides a simple API for common matching tasks.

What are matcher's main functionalities?

Basic String Matching

This feature allows you to check if a string matches a given pattern using wildcards. In this example, 'hello' matches the pattern 'h*o'.

const matcher = require('matcher');
const result = matcher.isMatch('hello', 'h*o');
console.log(result); // true

Filtering Arrays

This feature allows you to filter an array of strings based on a pattern. In this example, the array ['foo', 'bar', 'baz'] is filtered to include only strings that start with 'b'.

const matcher = require('matcher');
const result = matcher(['foo', 'bar', 'baz'], 'b*');
console.log(result); // ['bar', 'baz']

Negated Patterns

This feature allows you to exclude strings that match a given pattern. In this example, the array ['foo', 'bar', 'baz'] is filtered to exclude strings that start with 'b'.

const matcher = require('matcher');
const result = matcher(['foo', 'bar', 'baz'], '!b*');
console.log(result); // ['foo']

Other packages similar to matcher

Keywords

FAQs

Package last updated on 03 Oct 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc