1.1.0 • Published 9 years ago

fj-ifelse v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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

NameTypeDescription
predicatefunctionFunction that returns true or false
thenfunctionFunction called if predicate is true
otherwisefunctionFunction called if predicate is false

Returns

TypeDescription
functionReturns a function wich passes the values to the predicate
1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago