wildcard

Wildcard matching tools

npm install wildcard
13 downloads in the last week
77 downloads in the last month

wildcard

Very simple wildcard matching, which is designed to provide the same functionality that is found in the eve eventing library.

Build Status

It works with strings:

wildcard('foo.*', 'foo.bar'); // true
wildcard('foo.*', 'foo'); // true

Arrays:

var testdata = [
    'a.b.c',
    'a.b',
    'a',
    'a.b.d'
];

wildcard('a.b.*', testdata); // ['a.b.c', 'a.b', 'a.b.d']

Objects (matching against keys):

var testdata = {
    'a.b.c' : {},
    'a.b'   : {},
    'a'     : {},
    'a.b.d' : {}
};

wildcard('a.*.c', testdata); // { 'a.b.c': {} }

While the library works in Node, if you are are looking for file-based wildcard matching then you should have a look at:

https://github.com/isaacs/node-glob

npm loves you