Miss any of our Open RFC calls?Watch the recordings here! »


0.1.2 • Public • Published

matched NPM version

Extends minimatch with support for multiple patterns. Similar to multimatch, but returns expected results and passes all tests (see readme). Also similar to globule.match but more compact (and passes all globule.match tests).


Install with npm:

npm i matched --save-dev


var matched = require('matched');
matched(['foo', 'bar', 'baz'], ['!*a*', '*z'])
// => ['baz']


In the command line, run:


All of the unit tests include tests for multimatch, the .match() method from globule, and this library, matched.


The following comparison summarizes (part of) the motivation for creating this lib.

Given that we have an array of files:

var files = [

Using this glob pattern: ['!**/*z.js', '**/foo.js'], what should the results be? Here is the each lib would handle them.

Lib Result Notes
matched ['vendor/js/foo.js'] correct
globule.match ['vendor/js/foo.js'] correct
multimatch ['vendor/js/foo.js', 'vendor/js/bar.js'] incorrect, since we didn't ask for vendor/js/bar.js

See the tests for more examples.


Jon Schlinkert


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

This file was generated by verb-cli on June 14, 2014.