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

nanomatch

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanomatch

Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)

  • 1.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1M
decreased by-60.1%
Maintainers
1
Weekly downloads
 
Created

What is nanomatch?

Nanomatch is a fast and lightweight glob matcher for JavaScript. It is used to match file paths using glob patterns, which are simplified regular expressions. Nanomatch is designed to be smaller and faster than other globbing libraries, making it suitable for performance-critical applications.

What are nanomatch's main functionalities?

Basic Glob Matching

Nanomatch can be used to match file paths against glob patterns. In this example, it matches all JavaScript files in the array.

const nanomatch = require('nanomatch');
const files = ['foo.js', 'bar.js', 'baz.js'];
const matched = nanomatch(files, '*.js');
console.log(matched); // ['foo.js', 'bar.js', 'baz.js']

Negation Patterns

Nanomatch supports negation patterns, allowing you to exclude certain files from the match. In this example, it matches all JavaScript files except 'bar.js'.

const nanomatch = require('nanomatch');
const files = ['foo.js', 'bar.js', 'baz.js'];
const matched = nanomatch(files, ['*.js', '!bar.js']);
console.log(matched); // ['foo.js', 'baz.js']

Advanced Glob Patterns

Nanomatch supports advanced glob patterns, including brace expansion and character classes. In this example, it matches all JavaScript and text files except those starting with 'foo'.

const nanomatch = require('nanomatch');
const files = ['foo.js', 'bar.js', 'baz.js', 'foo.txt'];
const matched = nanomatch(files, ['*.{js,txt}', '!foo.*']);
console.log(matched); // ['bar.js', 'baz.js']

Other packages similar to nanomatch

Keywords

FAQs

Package last updated on 27 Nov 2017

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