7.0.0 • Published 5 months ago

multimatch v7.0.0

Weekly downloads
3,904,574
License
MIT
Repository
github
Last release
5 months 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/create@lerna/filter-packageslerna@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-selectorsng-morphning-climysoft-paas-clinew-app-clinext-in-it-statsmyclaspnois-react-toastaircos-cli@zalastax/nolb-multimactionsflow-core@yanluo/x-cliFrontend-starter@zzwing/create-appalmairhubs-cliakamai-staging@zenghj/saber-cli@zhijiang3/wepy-cliabbo@yoitsro/lerna-bootstrap@yoitsro/lerna-filter-packages@yq-group/yq-cli@yuheiy/metalsmith-html-frontmatter@yuanhua/cliangu-cliaxios-yet-another-proxy-fixaraucanos-sql-scm@angel6/cliawesome-react-stars@assits/mifan-clibeam-clibees-cliauto-plugava-files@allgemein/configava-no-babel@abacollection/webapfe-clibirdpush-vue-cli@aw-web-design/lerna-run
7.0.0

5 months ago

6.0.0

2 years ago

5.0.0

3 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.1.0

8 years ago

2.0.0

9 years ago

1.0.1

9 years ago

1.0.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago