All Projects → kevva → match-condition

kevva / match-condition

Licence: MIT License
Check if a value matches a condition

Programming Languages

javascript
184084 projects - #8 most used programming language

match-condition Build Status

Check if a value matches a condition

Install

$ npm install match-condition

Usage

const matchCondition = require('match-condition');

matchCondition('unicorns', 'unicorns');
//=> true

matchCondition('unicorns', /^unicorns$/);
//=> true

matchCondition('unicorns', '*corns');
//=> true

matchCondition('unicorns' val => val === 'unicorns');
//=> true

API

matchCondition(value, condition)

value

Type: string number

Value to be matched.

condition

Type: Function string boolean RegExp

Condition to match the value against.

License

MIT © Kevin Martensson

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].