A type of elements.
Tests whether all elements pass the test implemented by the provided function.
Corresponds to Array.prototype.every()
.
A predicate function to test each element. Returns true
to continue tests, or false
to stop it
and return false
from the method call. It accepts the tested element as the only parameter.
true
if the test
function returned a truthy value for every element, or false
otherwise.
Returns true
for empty iterable.
Creates an iterable with all elements that pass the test implemented by the provided function.
Corresponds to Array.prototype.filter()
.
A predicate function to test each element. Returns true
to keep the element, or false
otherwise.
It accepts the tested element as the only parameter.
A new AIterable with the elements that pass the test. If no elements passed the test, an empty iterable will be returned.
Creates an iterable with all elements extending the given type.
Corresponds to Array.prototype.filter()
.
Target type.
A predicate function to test that element extends the type R. Returns true
to keep the element, or
false
otherwise. It accepts the tested element as the only parameter.
A new AIterable with the elements that pass the test. If no elements passed the test, an empty iterable will be returned.
First maps each element using a mapping function, then flattens the result into a new iterable.
Corresponds to Array.prototype.flatMap()
.
Note that the overridden flatMap
method of ArrayLikeIterable
expects an array to be returned from convert
callback, while in this method it may return arbitrary iterable.
A type of converted elements.
A function that produces a new iterable, taking the source element as the only parameter.
A new AIterable with each element being the flattened result of the convert
function call.
Performs the given action
for each element.
Corresponds to Array.prototype.forEach()
.
An action to perform on each iterable element. This is a function accepting an element as its only parameter.
Creates a new iterable with the results of calling a provided function on every element.
Corresponds to Array.prototype.map()
.
A type of converted elements.
A function that produces an element of the new iterable, taking the source element as the only parameter.
A new AIterable with each element being the result of the convert
function call.
Applies a function against an accumulator and each element to reduce elements to a single value.
Corresponds to Array.prototype.reduce()
.
A type of reduced value.
A function to apply the value returned from the previous reducer
call and to each element.
Initial value passed to the first reducer
call.
Reduced value returned from the last reducer
call, or initialValue
if there is no elements in this
iterable.
Constructs an iterable containing this iterable's elements in reverse order.
By default this method converts iterable to array and then reverts its elements with reverseArray function.
Reversed AIterable instance.
Tests whether some element passed the test implemented by the provided function.
Corresponds to Array.prototype.some()
.
A predicate function to test each element. Returns false
to continue tests, or true
to stop it
and return true
from the method call. It accepts the tested element as the only parameter.
true
if the test
function returned a truthy value for some element, or false
otherwise.
Returns false
for empty iterable.
Passes each element of this iterable trough a chain of transformation passes.
The passes are preformed by @proc7ts/call-thru
library.
Next iterable of transformed elements.
Creates an AIterable
instance that iterates over the same elements as the given one.
Uses reverseIt function to reverse the constructed iterable.
A source iterable.
Always new AIterable
instance.
Checks whether the given iterable is an array-like one.
An iterable to check.
true
is the source
has all ArrayLikeIterable
methods (like Array
or AIterable
instance),
or false
otherwise.
Returns an iterable without elements.
An empty iterable instance.
Creates an AIterable instance that iterates over the same elements as the given one if necessary.
A source array-like iterable.
A source
itself.
Creates an AIterable instance that iterates over the same elements as the given one if necessary.
A source iterable.
Either source
itself if it implements ArrayLikeIterable
already (see is()
method),
or new AIterable instance iterating over the source
.
Generated using TypeDoc
Abstract
Iterable
implementation with array-like iteration operations.