7.0.0 • Published 2 years ago

multimatch v7.0.0

Weekly downloads
3,904,574
License
MIT
Repository
github
Last release
2 years ago

multimatch

Extends minimatch.match() with support for multiple patterns

Install

npm install multimatch

Usage

import multimatch from 'multimatch';

multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);
//=> ['unicorn', 'rainbows']

See the tests for more usage examples and expected matches.

API

multimatch(paths, patterns, options?)

Returns an array of matching paths in the order of input paths.

paths

Type: string | string[]

The paths to match against.

patterns

Type: string | string[]

Globbing patterns to use. For example: ['*', '!cake']. See supported minimatch patterns.

options

Type: object

See the minimatch options.

How multiple patterns work

Positive patterns (e.g. foo or *) add to the results, while negative patterns (e.g. !foo) subtract from the results.

Therefore a lone negation (e.g. ['!foo']) will never match anything. Use ['*', '!foo'] instead.

Globbing patterns

Just a quick overview.

  • * matches any number of characters, but not /
  • ? matches a single character, but not /
  • ** matches any number of characters, including /, as long as it's the only thing in a path part
  • {} allows for a comma-separated list of "or" expressions
  • ! at the beginning of a pattern will negate the match

Related

  • globby - Match against the filesystem instead of a list
  • matcher - Simple wildcard matching
@lerna/filter-packages@lerna/createlerna@hd-ui/cli@megasaur/bootstrap@megasaur/filter-packages@hn-ui/cli@~simple/cli@appirio/force-dev-toolsfdx-changeset-package_v1ui5-preloadbiercoff-swagger-axios-codegenkvue-clitemp-eleventy-temp@niefz/cliorbis-cli@frxf/frxfvue-ga-cli@mptjs/clijusfoun-climetalsmith-srcsetmetalsmith-mogrifymetalsmith-mangle-namesmetalsmith-mat2metalsmith-remove-unused-classesmetalsmith-remove-unused-cssmetalsmith-remove-unused-idsmetalsmith-minify-avifmetalsmith-minify-cssmetalsmith-minify-css-attributesmetalsmith-minify-gifmetalsmith-minify-htmlmetalsmith-minify-jpegmetalsmith-minify-jsmetalsmith-minify-pngmetalsmith-minify-svgmetalsmith-minify-tagsmetalsmith-minify-webpmetalsmith-scssmetalsmith-subset-fontmetalsmith-correct-htmlmetalsmith-exiftoolgulp-all-tasksescala-cli-sam-localforce-metadata-utilsbeet-clicupshe-flowcogoportutilsvui-clilalaliareaver-react-cliunblock-block-save-variablesgulp-sitemap-re@infinitebrahmanuniverse/nolb-multimplginndog-clitest-code-eslintg-wepy-cli@everything-registry/sub-chunk-2218gulp-obfuscate-selectorscabin-clitaskr-filtertaskr-sharptasly-clitaro-plugin-obfuscatortalent-ui-clitemplewallet-eslint-pluginsw-precache-webpack-dev-pluginsw-precache-webpack-dev-server-pluginsvi-cliswagger-http-codegenswagger-axios-code-generateswagger-code-fuswagger-axios-codegenswagger-axios-codegen-modtea-clltest-ftp-deploywinx-form-winxwool-cliweexpack-createwepy-cliwepy-cli-nextwepy-actwinning-cliwkstdwoex-cliweb-extweb-ext-runweb-workflow-cliweb-app-clivuezx-clivugvwk-clivx-cli-1vx-loginvue-cli-luozheaowebcheweimobpy-cliwf-cliwfe-cli
7.0.0

2 years ago

6.0.0

4 years ago

5.0.0

5 years ago

4.0.0

6 years ago

3.0.0

6 years ago

2.1.0

10 years ago

2.0.0

10 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago