npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

match-condition

1.1.1

@kevva

npmHomeRepoSnykSocket
Downloads:8
$ npm install match-condition
DailyWeeklyMonthlyYearly

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