node-wildcard
simple wildcard matcher for string, arrays and objects.
This module has the ability to pass in options to include non string values to be tested as well.
Allowed non-string types are: number
, boolean
, regexp
eg.
var wildcard = require('node-wildcard');
var testObj = {
'a.b': {},
'a': {}
}
var testArray = ['a.b', 'a']
console.log(wildcard('a', 'a.*' ))
console.log(wildcard('a.', 'a.*' ))
console.log(wildcard(testObj, 'a.*' ))
console.log(wildcard(testArray, 'a.*' ))
console.log(wildcard(1233, '123*' , options))
console.log(wildcard(false, 'fal*' , options))
console.log(wildcard(/false/, '*fal*' , options))
var options = {include: ['number', 'boolean', 'regexp']}
console.log(wildcard(143, '123*', options))
console.log(wildcard(1233, '123*' , options))
console.log(wildcard(false, 'fal*' , options))
console.log(wildcard(/false/, '*fal*' , options))
Better Docs Coming Soon
pull requests are encouraged.