fj-ifelse

1.1.0 • Public • Published

fj-ifElse

Build Status npm version

Functional ifElse

Installation

npm install fj-ifelse --save

Usage

var ifElse = require('fj-ifelse');
 
ifElse(
    (x) => x === true,
    (x) => t.ok(x),
    () => t.fail()
)(true);
 
var ifTrue = ifElse(() => true);
 
ifTrue(
    () => t.ok(true),
    () => t.fail()
)();

API

ifElse

Checks if a predicate returns true and calls the associated function.

ifElse(predicate, then, otherwise)

Parameters

Name Type Description
predicate function Function that returns true or false
then function Function called if predicate is true
otherwise function Function called if predicate is false

Returns

Type Description
function Returns a function wich passes the values to the predicate

Readme

Keywords

Package Sidebar

Install

npm i fj-ifelse

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • schtoeffel
  • hemanth