Class: FuseIterable

FuseIterable(values, tests)

FuseIterable

Constructor

new FuseIterable(values, tests)

Parameters:
Name Type Description
values iterable An iterable expression as the switch
tests Array.<function()> Array of { test, consequent } objects
Properties
Name Type Description
predicate function Test function
consequent function Consequent function
Source:

Methods

on(predicate, consequent) → {FuseIterable}

Accepts a test and consequent function each and returns a new FuseIterable instance. FuseIterable.prototype.for works a little differently than Fuse.prototype.for, by lazy accumulating the tests and resolving all the values when .resolve() is called.
Parameters:
Name Type Description
predicate callback A test callback function
consequent callback Consequent callback function
Source:
Returns:
An instance of FuseIterable
Type
FuseIterable

onField(…tuples) → {FuseIterable}

Accepts a list of tuples as arguments and returns a new FuseIterable instance. An alternative to chaining multiple FuseIterable.prototype.on methods.
Parameters:
Name Type Attributes Description
tuples Array.<function()> <repeatable>
Array of [ predicate, consequent ] pairs
Source:
Returns:
An instance of FuseIterable
Type
FuseIterable

resolve(…args) → {any|null}

Accepts parameters during resolve time and passes them along with each value into the winning consequent function.
Parameters:
Name Type Attributes Description
args any <repeatable>
Any number of arguments
Source:
Returns:
Resolved value or null if it was unresolved
Type
any | null