Skip to content

ForbesLindesay-Unmaintained/to-bool-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

to-bool-function

Convert things to functions for use in some/filter/every etc.

Build Status Dependency Status NPM version

Installation

$ npm install to-bool-function

API

var fun = require('to-bool-function');

fun('isAdmin')({isAdmin: true})
// => true

fun('isAdmin', false)({isAdmin: true})
// => false

fun('name', 'Forbes')({name: 'Forbes'})
// => true

fun(/^\S+@\S+\.\S+$/)('[email protected]')
// => true

fun(/^\S+@\S+\.\S+$/)('forbescomponent.io')
// => false

fun('contact.email', /^\S+@\S+\.\S+$/)({contact: {email: '[email protected]'}})
// => true

fun({contact: {realName: /\w+/,    email: /^\S+@\S+\.\S+$/}})
   ({contact: {realName: 'Forbes', email: '[email protected]'}})
// => true

License

MIT

About

Convert things to functions for use in some/filter/every etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published