Check if a value matches a condition
$ npm install --save match-condition
var matchCondition = require('match-condition');
matchCondition('unicorns', 'unicorns');
//=> true
matchCondition('unicorns', /^unicorns$/);
//=> true
matchCondition('unicorns', '*corns');
//=> true
matchCondition('unicorns', function (val) {
return val === 'unicorns';
});
//=> true
Required
Type: mixed
Value to be matched.
Required
Type: function, string, glob, boolean or regex
Condition to match the value against.
MIT © Kevin Martensson