match-condition
Check if a value matches a condition
Last updated 5 years ago by kevva .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install match-condition 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.1                                ...           latest (5 years ago)

3 Versions

  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (3)
Dev Dependencies (1)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |