Members
(static) NATURAL :Each.<number>
Infinite natural numbers starting from 0.
Type:
- Each.<number>
Methods
each(thatopt) → {Each|What.<Path>}
Computes the Cartesian product of this Each
with another.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
that |
Iterable.<*> |
<optional> |
Returns:
else(thatopt) → {Each}
Concatenates this Each
with another iterable.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
that |
Iterable.<*> |
<optional> |
Returns:
- Type
- Each
equals(that) → {boolean}
Compares this Each
with another for deep equality.
Parameters:
Name | Type | Description |
---|---|---|
that |
Iterable.<*> |
Returns:
- Type
- boolean
if(popt) → {Each}
Filters this Each
using a predicate.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p |
function | What |
<optional> |
(item) => item !== undefined |
Returns:
- Type
- Each
match(thatopt) → {Each}
Zips this Each
with another iterable.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
that |
Iterable.<*> |
<optional> |
Returns:
- Type
- Each
self() → {Each.<Each>}
Produces an infinite repetition of this Each
instance.
Returns:
then(f) → {Each}
Maps a function over each item.
Parameters:
Name | Type | Description |
---|---|---|
f |
function | What | Mapping function. |
Returns:
- Type
- Each
toArray() → {Array.<*>}
Converts this Each
instance into an array.
Returns:
- Type
- Array.<*>
what(opopt, startopt) → {*}
Reduces the iterable using an accumulator function.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
op |
function |
<optional> |
Binary operation. |
start |
* |
<optional> |
Initial value. |
Returns:
- Type
- *
when(p, startopt, inclusiveopt) → {Each}
Slices the iteration when the predicate (or index) triggers.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p |
function | number | Predicate or index. |
||
start |
boolean |
<optional> |
true | Whether to start or end at |
inclusive |
boolean |
<optional> |
start | Include the boundary element. |
Returns:
- Type
- Each
which(popt) → {Each}
Alias for if
. Distinct meaning in the context of What
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p |
function | What |
<optional> |
(item) => item !== undefined |
Returns:
- Type
- Each
(static) along(start, next) → {Each}
Creates a potentially infinite Each
starting from an initial value, generating next values using a function.
Parameters:
Name | Type | Description |
---|---|---|
start |
* | Initial value. |
next |
function | Function to generate next value. |
Returns:
A new Each
instance.
- Type
- Each
(static) as(itemsopt) → {Each}
Converts a value or iterable to a Each
instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
items |
undefined | any | Iterable.<any> |
<optional> |
Items to convert. |
Returns:
A new Each
instance.
- Type
- Each
(static) each(…aaa) → {What}
Computes the Cartesian product of multiple iterables, returned as a What
instance.
Instead of eagerly generating all combinations, this method returns a What
function
that incrementally extends a given path. For a path of length l
, it multiplies it
with the elements of the l
-th iterable (aaa[l]
). This lazy, functional form allows
selective traversal and early restriction of the Cartesian space without computing the
entire product upfront.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
aaa |
Iterable.<any> |
<repeatable> |
Input iterables representing the Cartesian factors. |
Returns:
A What
function that builds the Cartesian product incrementally.
- Type
- What
(static) else(aaa) → {Each}
Flattens a nested iterable by one level.
Parameters:
Name | Type | Description |
---|---|---|
aaa |
Iterable.<any> | Iterable of iterables. |
Returns:
Flattened Each
instance.
- Type
- Each
(static) equal(aa, bb) → {boolean}
Checks deep equality between two iterables.
Parameters:
Name | Type | Description |
---|---|---|
aa |
Iterable.<any> | |
bb |
Iterable.<any> |
Returns:
- Type
- boolean
(static) if(aa, popt) → {Each}
Filters an iterable using a predicate.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Iterable.<any> | The input iterable. |
||
p |
function |
<optional> |
item => item !== undefined | Predicate function. |
Returns:
Filtered Each
instance.
- Type
- Each
(static) match(…aaa) → {Each.<Array.<any>>}
Zips multiple iterables together.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
aaa |
Iterable.<any> |
<repeatable> |
Input iterables. |
Returns:
Zipped Each
instance.
- Type
- Each.<Array.<any>>
(static) of(…items) → {Each}
Creates a Each
from a list of items.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
items |
any |
<repeatable> |
Items to include. |
Returns:
A new Each
instance.
- Type
- Each
(static) self(aa) → {Each}
Yields the same iterable indefinitely.
Parameters:
Name | Type | Description |
---|---|---|
aa |
Iterable.<any> | The input iterable. |
Returns:
Infinite Each
instance.
- Type
- Each
(static) then(aa, f) → {Each}
Maps a function over items in an iterable.
Parameters:
Name | Type | Description |
---|---|---|
aa |
Iterable.<any> | The input iterable. |
f |
function | Mapping function. |
Returns:
Transformed Each
instance.
- Type
- Each
(static) what(aa, opopt, gotopt) → {*}
Reduces an iterable to a single value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
aa |
Iterable.<any> | The input iterable. |
|
op |
function |
<optional> |
Reducer function. |
got |
* |
<optional> |
Initial accumulator value. |
Returns:
Reduced value.
- Type
- *
(static) when(aa, p, startopt, inclusiveopt) → {Each}
Slices an iterable based on a predicate or index.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Iterable.<any> | The input iterable. |
||
p |
function | number | Predicate function or index. |
||
start |
boolean |
<optional> |
true | Whether to start or end slicing at match. |
inclusive |
boolean |
<optional> |
start | Whether to include the matched item. |
Returns:
Sliced Each
instance.
- Type
- Each
(static) which(aa, popt) → {Each}
Filters items from an iterable using a predicate.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Iterable.<any> | The input iterable. |
||
p |
function |
<optional> |
item => item !== undefined | Predicate function. |
Returns:
Filtered Each
instance.
- Type
- Each