promise-if
The if statement (or unary operator) for promises
Installation
Install promise-if
using npm:
npm install --save promise-
Usage
Module usage
var if = ; ifPromise Promise Promise ;
API
if(condition, trueVal, falsecondition)
Name | Type | Description |
---|---|---|
condition |
Mixed |
Condition |
trueVal |
Mixed |
What to return if condition resolves to a "truthy" value |
falseVal |
Mixed |
What to return if condition resolves to a "falsy" value |
Returns: Promise
, which resolves to what either trueVal
or falseVal
resolves to depending on condition
Related
License
MIT © Joakim Carlstein