1.0.0 • Published 10 years ago
matchy v1.0.0
matchy 
Match shallow objects
Install
$ npm install --save matchyUsage
var Match = require('matchy')
var match = Match([
{type: 'FooType'},
{name: /Bar$/},
{message: (value) => value && value.split('').reverse().join('') === 'raBooF'}
])
match({type: 'FooType'})
//=> true
match({name: 'FooBar'})
//=> true
match({name: 'FooBaz'})
//=> falseAPI
Match(data) -> function
data
Required
Type: object
A shallow object where the keys are error data keys and the values are:
- Strings or numbers (checked for strict equality)
- Regular expressions
- Functions (called with the error value for that key)
License
MIT © Ben Drucker
1.0.0
10 years ago