1.1.1 • Published 9 years ago

match-condition v1.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

match-condition Build Status

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