New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

picomatch

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

picomatch

Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.

4.0.2
latest
Version published
Weekly downloads
90M
1.28%
Maintainers
4
Weekly downloads
 
Created

What is picomatch?

The picomatch npm package is a minimal matching utility that uses glob patterns to test, match, or parse strings. It is designed to be a faster and lighter alternative to other pattern matching libraries, with a focus on performance and accuracy.

What are picomatch's main functionalities?

Glob matching

Use picomatch to create a matcher function for glob patterns, which can then be used to test if strings match the pattern.

const picomatch = require('picomatch');
const isMatch = picomatch('*.js');
console.log(isMatch('file.js')); // true
console.log(isMatch('file.txt')); // false

Multiple patterns

Create a matcher function that can handle multiple patterns, including negation patterns, to match against strings.

const picomatch = require('picomatch');
const isMatch = picomatch(['*.js', '!foo.js']);
console.log(isMatch('file.js')); // true
console.log(isMatch('foo.js')); // false

Parse glob patterns

Parse glob patterns to analyze their structure and components, which can be useful for understanding the pattern or for further processing.

const picomatch = require('picomatch');
const result = picomatch.parse('*.js');
console.log(result);

Other packages similar to picomatch

FAQs

Package last updated on 28 Mar 2024

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