Abstract
Applies a sequence projection on each element of this
sequence and concatenates the
resulting sequences.
The sequence projection to apply to each element.
A new sequence with the flattened results.
Calls a side-effect function after all elements have been yielded, but before iteration finishes.
⚠️ If the client stops iterating early, the function won't be called.
A function to invoke after iteration completes.
A new sequence that acts like this
but invokes action
before it finishes.
🦥Lazily gets the element at the given index in this
sequence, or undefined if the
index is out of bounds.
ℹ️ Negative indexes count from the end of the sequence.
⚠️ Requires iterating over the sequence up to the given index.
The index of the item to retrieve.
A 🦥DoddleAsync that resolves to the item at the given index.
Handles errors thrown while iterating over this
sequence.
A handler that will be called with the error and the index of the element that
caused it. Should return a new sequence or undefined
, which stops iteration.
A new sequence that handles errors.
Splits this
sequence into chunks of the given size, optionally applying a projection to
each chunk.
ℹ️ The last chunk may be smaller than the given size.
The size of each chunk.
Optionally, an N-ary projection to apply to each chunk. Defaults to collecting the elements into an array.
A new sequence.
Returns a new sequence. When iterated, before yielding its first element, it will iterate
over all the elements of this
and store them in memory. Then it will yield all of them one
by one.
ℹ️ Used to control side-effects. Makes sure all side-effects execute before continuing to apply other operators.
A new sequence with the same elements as this one, but where iteration has already completed.
Concatenates one or more sequences to the end of this
, so that their elements appear in
order.
The sequential inputs to concatenate to the end of this
.
A new sequence with the concatenated elements.
Applies a sequence projection on each element of this
sequence and concatenates the
resulting sequences.
The sequence projection to apply to each element.
A new sequence with the flattened results.
🦥Lazily counts the number of elements in this
sequence.
⚠️ Requires iterating over the entire sequence.
A 🦥DoddleAsync that resolves to the number of elements in this
.
🦥Lazily counts the number of elements in this
sequence that match the given predicate.
⚠️ Requires iterating over the entire sequence.
The predicate used to test each element.
A 🦥DoddleAsync that resolves to the number of matching elements.
Calls an action function as each element in this
is iterated over. Calls the function
before or after yielding the element, or both.
The action function to invoke for each element.
The stage at which to invoke the function. Can be "before"
, "after"
, or
"both"
.
A new sequence that invokes the action function while being iterated.
🦥Lazily checks if all elements in this
sequence match the given predicate.
⚠️ May iterate over the entire sequence.
The predicate.
A 🦥DoddleAsync that yields true
if all elements match, or false
otherwise.
Filters the elements of this
sequence based on the given predicate.
The predicate to filter elements.
A new sequence with the filtered elements.
🦥Lazily finds the first element in this
sequence, or undefined
if it's empty.
A 🦥DoddleAsync that resolves to the first element or the alternative value.
🦥Lazily finds the first element in this
sequence that matches the given predicate.
⚠️ May iterate over the entire sequence.
The predicate used to find the element.
Optional
alt: AltThe value to return if no element matches the predicate. Defaults to undefined
.
Groups the elements of this
sequence by key, resulting in a sequence of pairs where the
first element is the key and the second is a sequence of values.
The projection used to determine the key for each element.
A sequence of pairs.
🦥Lazily checks if this
sequence includes one or more values by iterating over it.
⚠️ May iterate over the entire sequence.
🦥Lazily checks if this
sequence includes one or more values.
⚠️ May iterate over the entire sequence.
The values to check for inclusion.
🦥Lazily joins the elements of this
sequence into a single string, separated by the
given separator.
⚠️ Requires iterating over the entire sequence.
The string to use as a separator between elements.
A 🦥DoddleAsync that resolves to the joined string.
🦥Lazily gets the last element in this
sequence, or undefined
.
A 🦥DoddleAsync that resolves to the last element in this
sequence, or
undefined
.
🦥Lazily finds the last element in this
sequence that matches the given predicate.
⚠️ Requires iterating over the entire sequence.
The predicate for testing each element.
Optional
alt: AltOptionally, the value to return if no matching value is found. Defaults to
undefined
.
A 🦥DoddleAsync that resolves to the last matching element or the alternative value.
Applies a projection to each element of this
sequence.
The projection to apply to each element.
A new sequence with the projected elements.
🦥Lazily finds the maximum element in this
sequence by key, or the given alternative
value if the sequence is empty.
Projects each element into a key so it can be compared.
Optional
alt: AltThe value to return if the sequence is empty. Defaults to undefined
.
🦥Lazily finds the minimum element in this
sequence by key, or the given alternative
value if the sequence is empty.
Projects each element into a key so it can be compared.
Optional
alt: AltThe value to return if the sequence is empty. Defaults to undefined
.
A 🦥DoddleAsync that resolves to the element with the minimum key, or alt
if the sequence is empty.
Orders the elements of this
sequence by key, using the given key projection.
⚠️ Has to iterate over the entire sequence.
A projection that returns a key to order by.
Optional
descending: booleanWhether to use descending order.
A new sequence with the elements ordered by the given key.
Orders the elements of this
using the given mutli-key tuple projection.
ℹ️ The keys are compared in the order they appear.
⚠️ Has to iterate over the entire sequence.
A projection function that returns a tuple of keys to order by.
Optional
descending: booleanWhether to use descending order.
A new sequence with the elements ordered by the given keys.
Returns a cartesian product of this
sequence with one or more other sequences, optionally
applying an N-ary projection to each combination of elements.
The product of N
sequences is the collection of all possible sets of elements from each
sequence.
For example, the product of [1, 2]
and [3, 4]
is:
;[
[1, 3],
[1, 4],
[2, 3],
[2, 4]
]
A new sequence.
🦥Lazily reduces this
sequence to a single value by applying the given reduction.
ℹ️ Uses the first element as the initial value.
A 🦥DoddleAsync that resolves to the reduced value.
🦥Lazily reduces this
sequence to a single value by applying the given reduction.
ℹ️ You need to supply an initial value.
The reduction to apply to each element.
The initial value to start the reduction with.
Applies a reduction to each element of this
sequence. Returns a new sequence that yields
the accumulated value at each step.
ℹ️ The first element is used as the initial value.
A new sequence with the accumulated values.
Applies a reduction to each element of this
sequence. Returns a new sequence that yields
the accumulated value at each step.
ℹ️ You need to supply an initial value.
The initial value to start the reduction with.
🦥Lazily checks if this
sequence is equal to the input
sequence.
ℹ️ For two sequences to be equal, their elements must be equal and be in the same order.
A 🦥DoddleAsync that resolves to true
if all elements are equal, or false
🦥Lazily checks if this
sequence is equal to the input
sequence.
ℹ️ For two sequences to be equal, their elements must be equal and be in the same order.
A 🦥DoddleAsync that resolves to true
if all elements are equal, or false
🦥Lazily checks if this
sequence is equal to the input
sequence.
The elements are compared by key, using the given key projection.
A 🦥DoddleAsync that resolves to true
if all elements are equal, or false
otherwise.
🦥Lazily checks if this
sequence contains the same elements as the input sequence,
without regard to order.
⚠️ Requires iterating over the entire sequence.
A 🦥DoddleAsync that resolves to true
if this
is set-equal to the input,
or false
otherwise.
🦥Lazily checks if this
sequence contains the same elements as the input sequence,
without regard to order.
⚠️ Requires iterating over the entire sequence.
A 🦥DoddleAsync that resolves to true
if this
is set-equal to the input,
or false
otherwise.
🦥Lazily checks if this
sequence contains the same elements as the input sequence,
without regard to order.
ℹ️ The elements are compared by key, using the given key projection.
A 🦥DoddleAsync that resolves to true
if this
is set-equal to the input,
or false
otherwise.
Skips elements from this
sequence while the given predicate is true, and yields the rest.
ℹ️ You can use the options
argument to skip the first element that returns false
.
The predicate to determine whether to continue skipping.
Optional
options: { skipFinal?: boolean }Options for skipping behavior.
Optional
skipFinal?: booleanWhether to skip the boundary element for which the predicate returns false
.
A new sequence without the skipped elements.
🦥Lazily checks if any element in this
sequence matches the given predicate, by
iterating over it until a match is found.
The predicate to match the element.
A 🦥DoddleAsync that resolves to true
if any element matches, or false
otherwise.
🦥Lazily sums the elements of this
sequence by iterating over it, applying the given
projection to each element.
The projection function to apply to each element.
A 🦥DoddleAsync that resolves to the sum of the projected elements.
Yields the first elements of this
sequence while the given predicate is true and skips the
rest.
ℹ️ If the sequence is too small, the result will be empty.
ℹ️ The options
argument lets you keep the first element for which the predicate returns
false
.
The predicate to determine whether to continue yielding.
Optional
specifier: { takeFinal?: boolean }A new sequence with the yielded elements.
🦥Lazily converts this
sequence into an array.
⚠️ Has to iterate over the entire sequence.
A 🦥DoddleAsync that resolves to an array of the elements in the sequence.
🦥Lazily converts this
sequence into a Map.
⚠️ Has to iterate over the entire sequence.
A function that takes an element and returns a key-value pair.
A 🦥DoddleAsync that resolves to a Map of the elements in the sequence.
🦥Lazily converts this
sequence into a plain JS object. Uses the given kvpProjection
to determine each key-value pair.
A function that takes an element and returns a key-value pair. Each key must be a valid PropertyKey.
A 🦥DoddleAsync that resolves to a plain JS object.
Lazily converts this
async sequence into a synchronous Seq sequence.
⚠️ Has to iterate over the entire sequence.
A 🦥DoddleAsync that resolves to a synchronous Seq sequence.
🦥Lazily converts this
sequence into a Set.
⚠️ Has to iterate over the entire sequence.
A 🦥DoddleAsync that resolves to a Set of the elements in the sequence.
Filters out duplicate elements from this
sequence, optionally using a key projection.
ℹ️ Doesn't need to iterate over the entire sequence.
⚠️ Needs to cache the sequence as it's iterated over.
A function that takes an element and returns a key used to check for uniqueness.
A sequence of unique elements.
Splits this
async sequence into overlapping windows of fixed size, applying a projection to
each window.
ℹ️ If the sequence is smaller than the window size, one smaller window will yielded.
The size of each window.
A function to project each window to a value.
A new sequence of windows or projected results.
Zips this
sequence with other sequences, yielding tuples of elements that appear in the
same position in each sequence.
ℹ️ Sequences that are exhausted will yield undefined
for their elements.
ℹ️ The resulting sequence will be as long as the longest input sequence.
A new async sequence of tuples containing parallel elements.
Zips this
sequence with other sequences, applying a projection to each set of elements and
yielding the results.
ℹ️ Sequences that are exhausted will yield undefined
for their elements.
ℹ️ The resulting sequence will be as long as the longest input sequence.
A new sequence of elements generated from the zipped values.
The ASeq class, which wraps an async iterable.