1.1.1 • Published 9 years ago
match-condition v1.1.1
match-condition
Check if a value matches a condition
Install
$ npm install --save match-condition
Usage
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
API
matchCondition(value, condition)
value
Required
Type: mixed
Value to be matched.
condition
Required
Type: function
, string
, glob
, boolean
or regex
Condition to match the value against.
License
MIT © Kevin Martensson