Common Rules:
These variants are postfixed by an underscore.
They take the _
callback as first parameter.
They pass the _
callback as first arguement to their fn
callback.
Most of them have an optional options
second parameter which controls the level of
parallelism. This options
parameter may be specified as { parallel: par }
where par is an integer, or directly as a par
integer value.
The par
values are interpreted as follows:
- If absent or equal to 1, execution is sequential.
- If > 1, at most
par
operations are parallelized. - if 0, a default number of operations are parallelized. This default can be read and set with funnel.defaultSize (4 by default)
- If < 0 or Infinity, operations are fully parallelized (no limit).
API:
array.forEach_(_[, options], fn[, thisObj])
fn
is called asfn(_, elt, i)
.result = array.map_(_[, options], fn[, thisObj])
fn
is called asfn(_, elt, i)
.result = array.filter_(_[, options], fn[, thisObj])
fn
is called asfn(_, elt)
.bool = array.every_(_[, options], fn[, thisObj])
fn
is called asfn(_, elt)
.bool = array.some_(_[, options], fn[, thisObj])
fn
is called asfn(_, elt)
.result = array.reduce_(_, array, fn, val)
fn
is called asval = fn(_, val, elt, i, array)
.result = flows.reduceRight(_, array, fn, val, [thisObj])
reduces from end to start by applyingfn
to each element.
fn
is called asval = fn(_, val, elt, i, array)
.array = flows.sort(_, array, compare, [beg], [end])
compare
is called ascmp = compare(_, elt1, elt2)
Note: this function changes the original array (and returns it)
result = fn.apply_(_, thisObj, args, [index])
Helper to useFunction.prototype.apply
with streamline functions.
Equivalent toresult = fn.apply(thisObj, argsWith_)
whereargsWith_
is a modified argument list in which the callback has been inserted atindex
(at the end of the argument list ifindex
is not specified).