Applies an accumulator function over an interable.
The accumulator function to apply over the iterable.
The final accumulator value.
Applies an accumulator function over an interable.
The accumulator function to apply over the iterable.
The seed to set the initial acc
param to in the accumulator function.
If not given, then the first element is used.
The final accumulator value.
Returns whether all elements satisfy the given condition.
The function to use to test each element.
Whether all elements satisfied the condition.
Returns whether the iterable is not empty.
Whether the iterable is not empty.
Returns whether any of the elements satisfy the given condition.
The function to use to test each element.
Whether any element in the iterable satisfied the condition.
If the iterable was empty, then false
is returned
Appends the element to the end of the iterable.
The element to append.
Applies the given lazy iterable implementation to the current object. This allows for using custom Lazy implementations using the standard chaining syntax.
The function that will create the iterable instance using the current object.
The instantiated iterable object.
Computes the average of the iterable.
The numeric average of the iterable.
Computes the average of result of the selector function over the iterable.
The transformation function to use for each element.
The numeric average of the results of the selector function.
Batches elements in groups of the given batch size.
The size of each batch.
Whether to include batches that are smaller than the target size. This only applies to the final batch of the iterable if the total size is not a multiple of the batch size.
Resolves the underlaying iterable completely and returns a lazy of the result.
Concatinates multiple iterables in order.
The other iterables to concatinate with.
Determines whether the iterable has a given element.
The value to search for.
The function that compares 2 elements and returns a boolean on whether they
are equal or not. If not given, defaults to strict equals (===
).
Whether the element was in the iterable.
Returns the number of elements in the iterable.
The number of elements in the iterable.
Returns the number of elements that satify the given condition.
The predicate to test each element with.
The number of elements in the iterable that matched the condition.
Returns the elements in the iterable, or the given default value as the only element if it contained none.
The value to use if the iterable was empty.
Returns the distinct elements in the iterable.
A mapping function to get the key to compare with. The result
will be effectively compared using a strict equals (===
) against the others.
If not given, then each element will used directly.
Returns the element at the given index of the iterable.
The index of the element to get.
The element at the given index.
Returns the element at the given index of the iterable, or the given default value if out of range.
The index of the element to get.
The default value to use if the index was out of range.
The element at the given index.
Returns the element at the given index of the iterable, or the given default value if out of range.
The index of the element to get.
The default value to use if the index was out of range.
The element at the given index.
Returns the set difference between 2 iterables. This like doing an XOR over the 2 iterables.
The iterable to get the difference of.
A mapping function to get the key to compare with. The value
will be effectively compared using a strict equals (===
) againt the others.
If not given, then each element will used directly.
Returns the first element in the iterable.
The first element in the iterable.
Returns the first element that satisfies the given condition.
The predicate to test each element with.
The first element in the iterable that satisfies the condition.
Returns the first element in the iterable, or the given default value if the iterable was empty.
The value to use of the iterable was empty.
The first element in the iterable, or the default value if empty.
Returns the first element in the iterable, or the given default value if the iterable was empty.
The value to use of the iterable was empty.
The first element in the iterable, or the default value if empty.
Returns the first element in the iterable that satisfies the condition, or the given default value.
The value to use if no element satisfied the condition.
The predicate to test each element with.
The first element in the iterable that satisfies the condition, or the default value if none satisfied it.
Returns the first element in the iterable that satisfies the condition, or the given default value.
The value to use if no element satisfied the condition.
The predicate to test each element with.
The first element in the iterable that satisfies the condition, or the default value if none satisfied it.
Mimics the behaviour of Array.prototype.forEach
, with the exception
of not providing the entire array as the 3rd param of the callback.
The callback function that will be executed for each element in the iterable.
Groups the elements by key.
The function to extract the key from each element.
Groups the elements by key and projects each element using the given function.
The function to extract the key from each element.
The transformation function to use for each element.
Groups the elements by key and projects each element using the given function. The elements of each group are projected using the given function.
The function to extract the key from each element.
The transformation function to use for each element.
The transformation function to create the result elements with.
Joins 2 iterables on the given key and groups the results.
The other iterable to group join with.
The function that extracts the key from an element of the first iterable.
The function that extracts the key from an element of the second iterable.
The function that takes an element from the first and an iterable of elements from the second, and outputs the resulting element.
Returns the set intersection between 2 iterables. This like doing an AND over the 2 iterables.
The iterable to get the intersection of.
A mapping function to get the key to compare with. The value
will be effectively compared using a strict equals (===
) against the others.
If not given, then each element will used directly.
Determines whether 2 iterables are equal.
The iterable to compare against.
The function to perform the comparision of each pair of
elements with. If not given, defaults to strict equals (===
).
Whether the 2 iterables were both equal.
Joins 2 iterables on the given matching keys. This is similar to a JOIN in SQL.
The iterable to join.
The function that extracts the key from the first iterable.
The function that extracts the key from the second iterable.
The function that takes in a single element from the from each of the first and second iterables, and outputs the resulting element.
Returns the last element in the iterable.
The last element in the iterable.
Returns the last element in the iterable that satisfies the given condition.
The predicate to test each element with.
The last element in the iterable that satisfied the condition.
Returns the last element in the iterable, or the given default value if the iterable was empty.
The value to use of the iterable was empty.
The last element in the iterable, or the default value if empty.
Returns the last element in the iterable, or the given default value if the iterable was empty.
The value to use of the iterable was empty.
The last element in the iterable, or the default value if empty.
Returns the last element in the iterable that satisfies the given condition, or the given default value.
The value to use of the iterable was empty.
The predicate to test each element with.
The last element in the iterable, or the default value if no element satisfied the condition.
Returns the last element in the iterable that satisfies the given condition, or the given default value.
The value to use of the iterable was empty.
The predicate to test each element with.
The last element in the iterable, or the default value if no element satisfied the condition.
Returns the maximum value in the iterable.
The maximum element.
Returns the maximum value of result of the selector function over the iterable.
The transformation function to use for each element.
The maximum result of the selector function.
Returns the minimum value in the iterable.
The minimum element.
Returns the minimum value of result of the selector function over the iterable.
The transformation function to use for each element.
The minimum result of the selector function.
Sorts the iterable in ascending order.
The function used to get the key from a given element.
The function that is passed to Array.prototype.sort
to
compare values and return the comparison number. If not given, a default
sorting function will be used. This sorting function will match the
behaviour of the standard sort comparison function.
Sorts the iterable in descending order.
The function used to get the key from a given element.
The function that is passed to Array.prototype.sort
to
compare values and return the comparison number. If not given, a default
sorting function will be used. This sorting function will match the
behaviour of the standard sort comparison function.
Sorts the iterable in acending order according to the numeric result of the key function.
The function user to get the key from the given element.
Sorts the iterable in descending order according to the numeric result of the key function.
The function used to get the key from a given element.
Prepends the element to the beginning of the iterable.
The element to prepend.
Reverses the order of the iterable.
Projects the elements of the iterable into a new form.
The transformation function to use for each element.
Projects the elements of the iterable into a new form, and flattens the iterable of iterables into a single iterable.
The transformation function to use for each element. The index parameter is the index that the element was at in the source iterable, not the resulting one.
Returns a single element from the iterable that matches the given condition.
The predicate function to test each element with.
The element that satisfies the condition.
Returns a single element from the iterable that matches the given condition, or a default value if no element was found.
The predicate function to test each element with.
The default value to use if no element could be found.
The element that satisfies the condition, or the default value if no element was found.
Returns a single element from the iterable that matches the given condition, or a default value if no element was found.
The predicate function to test each element with.
The default value to use if no element could be found.
The element that satisfies the condition, or the default value if no element was found.
Skips the given number of elements from the start of the iterable and returns the rest.
The number of elements to skip.
Skips the given number of elements from the end of the iterable, returning the rest.
The number of elements to skip from the end.
Skips all elements in the iterable until the condition returns true, after which all elements are returned regardless.
The predicate function to check the condition with.
Joins all the elements in the iterable together into a single string, split by the given separator.
The separator to split each element with in the string.
Defaults to ''
.
The function to convert each element into a string.
Computes the sum of all the elements in the iterable.
The sum of all the elements.
Returns the sum of all the results of the selector function over the iterable.
The transformation function to use for each element.
The sum of the results of the selector function.
Returns the given number of elements from the start of the iterable, ignoring the rest.
The number of elements to take from the start.
Returns the given number of elements from the end of the iterable, ignore the elements before.
Takes all elements in the iterable until the condition returns true, after which the iterable is considered to have ended.
The predicate function to check the condition with.
Converts the iterable into a standard JavaScript Array
.
Converts the iterable to a JSON-serialisable array.
Converts the iterable into a map using the key and value function.
The function to use to derive the key of each map element.
The function to use to derive the value of map value. If not given, then the value itself is used.
A Map<TKey, TResult>
derived from the iterable.
Returns the set union between 2 iterables. This like doing an OR over the 2 iterables.
The iterable to get the union of.
A mapping function to get the key to compare with. The value
will be effectively compared using a strict equals (===
) against the others.
If not given, then the element will used directly.
Filters elements based on the given predicate.
The predicate function to filter elements with.
Filters elements based on the given predicate.
The predicate function to filter elements with.
Combines 2 iterables into an iterable of tuples. This will merge elements on the same index, finishing on the iterable that finishes first. If the first iterable has 3 elements, and the second 4, then the result will have 3 elements.
The iterable to zip with.
Combines 2 iterables using the given selector. This will merge elements on the same index, finishing on the iterable that finishes first. If the first iterable has 3 elements, and the second 4, then the result will have 3 elements.
The iterable to zip with.
The function to combine the iterables with.
Creates an empty lazy iterable.
The empty lazy iterable object.
Creates a lazy iterable object from the given iterable object.
The object to source for lazy iteration.
The lazy iterable object with the given iterable as the source.
Creates a lazy iterable object that will produce a range of integers.
The starting number of the range (inclusive).
The ending number of the range (exclusive). If not given, then the value is assumed to be +Infinity.
The lazy iterable object with the range as the source.
Creates a lazy iterable object that will repeate the element a given number of times.
The value to repeat.
The number of times to repeat it. If not given, then the value is assumed to be +Infinity.
The lazy iterable object with the repeated value as the source.
Generated using TypeDoc
The base class that all lazy iterable objects derive from. This can be extended with custom iterators if needed.