Check if a value matches a condition
$ npm install match-condition
const matchCondition = require('match-condition');
matchCondition('unicorns', 'unicorns');
//=> true
matchCondition('unicorns', /^unicorns$/);
//=> true
matchCondition('unicorns', '*corns');
//=> true
matchCondition('unicorns' val => val === 'unicorns');
//=> true
Type: string
number
Value to be matched.
Type: Function
string
boolean
RegExp
Condition to match the value against.
MIT © Kevin Martensson