Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

iffy

1.0.0 • Public • Published

iffy Build Status

Ternary in a function, but performant through closure science

Install

$ npm install --save iffy

Usage

var iffy = require('iffy')
 
iffy(true, onTrue, onFalse) // => onTrue called
 
iffy(false, onTrue, onFalse) // => onFalse called

API

iffy(condition, onTrue, [onFalse]) -> value

condition

Required Type: any

If condition is truthy, onTrue will be called and its return value returned.

Otherwise, if onFalse is provided, it will be called and its return value returned.

onTrue

Type: function

onFalse

Type: function

Related

These are similar, but are less performant due to lack of closure science.

License

MIT © Andrew Joslin

install

npm i iffy

Downloadsweekly downloads

4

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability