Socket
Socket
Sign inDemoInstall

micromatch

Package Overview
Dependencies
0
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    micromatch

Like minimatch, but smaller and faster.


Version published
Maintainers
1
Created

Package description

What is micromatch?

The micromatch npm package is a fast, minimal glob utility for node.js and JavaScript. It is used to parse, match, and expand glob patterns against strings to filter, validate, or manipulate file paths, names, and other string lists.

What are micromatch's main functionalities?

Matching glob patterns

Match an array of strings to a glob pattern. In this example, it filters the list to include only files ending with '.js'.

const micromatch = require('micromatch');
const result = micromatch(['foo.js', 'bar.js'], '*.js');
console.log(result); // ['foo.js', 'bar.js']

Negating glob patterns

Use negation patterns to exclude matches. This example matches all '.js' files but excludes 'foo.js'.

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

Testing a filepath

Test a single filepath against a glob pattern to see if it matches. In this case, 'foobar.js' is a match for '*.js'.

const micromatch = require('micromatch');
const isMatch = micromatch.isMatch('foobar.js', '*.js');
console.log(isMatch); // true

Expanding braces

Expand braces in glob patterns to match multiple patterns. This example matches 'foo.js' and 'foo1.js' with a single pattern.

const micromatch = require('micromatch');
const result = micromatch(['foo.js', 'foo1.js'], 'foo{,1}.js');
console.log(result); // ['foo.js', 'foo1.js']

Other packages similar to micromatch

Changelog

Source

[0.1.0] - 2016-10-08

First release.

Readme

Source

micromatch NPM version

Like minimatch, but smaller and faster.

Install

Install with npm

npm i micromatch --save

Run tests

npm test

Usage

var micromatch = require('micromatch');

API

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on November 25, 2014.

FAQs

Last updated on 25 Nov 2014

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