
to-bool-function
Convert things to functions for use in some/filter/every etc.
Installation
$ component install ForbesLindesay/to-bool-function
or
$ npm install to-bool-function
API
var fun = require('to-bool-function');
fun('isAdmin')({isAdmin: true})
fun('isAdmin', false)({isAdmin: true})
fun('name', 'Forbes')({name: 'Forbes'})
fun(/^\S+@\S+\.\S+$/)('forbes@component.io')
fun(/^\S+@\S+\.\S+$/)('forbescomponent.io')
fun('contact.email', /^\S+@\S+\.\S+$/)({contact: {email: 'forbes@component.io'}})
fun({contact: {realName: /\w+/, email: /^\S+@\S+\.\S+$/}})
({contact: {realName: 'Forbes', email: 'forbes@component.io'}})
License
MIT