Global

Methods

advance(iter, size)

Advance an iterator by a given amount.
Parameters:
Name Type Description
iter iterator The iterator to advance .
size integer The number of items to advance by.
Source:
Returns:
The advanced iterator.

(generator) concat(…iters)

Concatinate iterators together.
Parameters:
Name Type Attributes Description
iters iterables <repeatable>
The iterators to concatinate.
Source:
Returns:
The resulting concatinated iterator.

(generator) fibonacci(initial, maximum)

Fibonacci sequence.
Parameters:
Name Type Default Description
initial number 1 The initial value.
maximum number The maximum value.
Source:
Returns:
An iterable fibonacci sequence.

(generator) filter(iter, fn)

Filter values.
Parameters:
Name Type Description
iter iterable The iterable to operator on.
fn function A function to filter each item.
Source:
Returns:
An iterator of filtered items.

(generator) limit(iter, length)

Limit wrapped iterator to a given length.
Parameters:
Name Type Description
iter iterable The iterable to operator on.
length integer The length to limit wrapper iterable to.
Source:
Returns:
The iterable limited to specified length.

(generator) map(iter, fn)

Map values.
Parameters:
Name Type Description
iter iterable The iterable to operator on.
fn function A function to transform/map each item.
Source:
Returns:
An iterator of mapped items.

(generator) range(from, to, step) → {integer}

Generator a range sequence.
Parameters:
Name Type Description
from integer Starting value, inclusive.
to integer Ending value value, inclusive.
step integer The amount to advance by.
Source:
Yields:
The next step in the range.
Type
integer
Example
range(0, 10);     // From 0-10 step 1 (auto)
range(10, 0);     // From 10-0 step -1 (auto)
range(20);        // From 0-20 step 1 (auto)
range(3, 12, 3);  // From 3-12 step 3

(generator) repeat(value, length) → {any}

Repeat a value.
Parameters:
Name Type Description
value any Any value to repeat.
length integer Number of times to repat.
Source:
Yields:
The repeated value.
Type
any

(generator) slice(iter, from, to)

Slice a range out of an iterable.
Parameters:
Name Type Description
iter iterable The iterable to operator on.
from integer The starting index.
to integer The ending index.
Source:
Returns:
An iterator of the sliced part.

taker(iter, last)

Build a function that takes the next item from an iterable. That function returns the 'last' value when done.
Parameters:
Name Type Description
iter iterable The iterable to operator on.
last any The value to return if at end.
Source:
Returns:
The function that takes the next item.
Example
const take = taker([ 1, 2 ], 0);
const first = take();  // 1
const second = take(); // 2
const third = take();  // 0
const fourth = take(); // 0