Abstractthe type of the elements within the stream
StaticallGenerates an infinite stream of integers, starting with start (which defaults to 0).
In other words, this produces the interval [start, start + 1, ...).
The returned stream is infinite, truncate the stream accordingly by using for example take(),
or break in a for...of loop.
Optionalstart: numberthe start value
StaticconcatStaticemptyStaticentriesStaticenumerateStaticfromWraps an iterable into a stream.
The returned stream can be iterated multiple times if the original iterable can also be iterated multiple times (some iterables, like generators, do not support repeated iteration).
StaticgenerateStaticintegersGenerates a stream of count integers, starting with 0.
In other words, this produces the interval [0, 1, ..., count).
the number of integers to produce
Generates a stream of count integers, starting with the provided start index.
In other words, this produces the interval [start +0, start +1, ..., start +count).
the start value
the number of integers to produce
StatickeysStaticofStaticvaluesStaticzipCreates a new stream by zipping the elements of the given iterables. The iterables will be iterated in parallel, so each element of the new stream will be a tuple with one element per iterable.
The stream stops when the shortest of the given iterables has ended.
the iterables to concatenate
StaticzipCreates a new stream by zipping the elements of the given iterables. The iterables will be iterated in parallel, so each element of the new stream will be a tuple with one element per iterable.
The stream stops when the longest of the given iterables has ended. When individual iterables are exhausted, their tuple items are set to undefined.
the iterables to zip
Abstract[iterator]Allows iteration in for...of loops.
Returns a stream over the original items grouped into chunks of size chunkSize.
Up to chunkSize consecutive elements will be gathered into an array and then
returned by the stream.
All arrays, except for the last one, will be of length chunkSize.
the maximum chunk size
Returns the number of elements in this stream.
NOTE: this will iterate over the entire stream!
Determines if all items in the stream fulfill the given predicate.
NOTE: Trivially returns true if the stream is empty.
Returns true if all item in the stream fulfills the given predicate, false otherwise.
Returns the first item in this stream, or undefined if the stream is empty.
Invokes the callback for every item in the stream.
Works exactly like Array's forEach function, with the exception that no source array is passed.
Returns a stream that groups adjacent elements for which the predicate returns true into arrays.
This is different from groupBy because it allows arbitrary conditions for grouping.
However, only elements next to each other can belong to a group.
A new group is started whenever an element is encountered that does not belong to the current group.
Groups items together for which keyFunc returns the same value.
The keyFunc function should generate keys that are supported by
JavaScript's Map type.
NOTE: This function reads the entire stream into memory and stores items in an internal map, which may be inefficient for very large datasets.
Returns true if this stream contains an element that compares equal
to item. Comparisons use strict equality (===).
Returns true if there is at least one element in this stream, false otherwise.
Joins all elements of this stream together into a string.
Individual elements will be converted to string (via String(elements))
and separated by separator.
The separator to use between two elements. Defaults to ",".
Returns the last item in this stream, or undefined if this stream is empty.
NOTE: This iterates over the entire stream in order to find the last element. Be aware of the performance implications: the function should not be called repeatedly (cache the result instead) and you should ensure that your stream is finite.
Returns the largest stream item according to the given compareFunc.
If multiple candidates for the largest element compare equal to each other,
the first of those items (according to the stream order) will be returned.
the largest item or undefined if the stream is empty.
Like max(), but compares keys derived from the stream's items instead of the items themselves.
The item with the largest key will be returned (or undefined if the stream is empty).
Given an item, returns a sort key for comparison during sorting. This function should be fast, because it will be invoked at least once for every element.
OptionalcompareFunc: (left: U, right: U) => numberGiven two keys derived by keyFunc, returns < 0 if left < right, > 0 if left > right and 0 otherwise.
When not specified, keys are compared using standard < and > (which might be useless,
e.g. when keys are objects or arrays).
the largest item or undefined if the stream is empty.
Returns a stream that skips elements while the predicate returns true.
Once the predicate returns false, all the following items will be included
in the returned stream.
A predicate determining if items shall be skipped. Once the predicate
returns false, all remaining items are included in the returned stream.
Determines if the given condition matches to at least one of the stream's items.
Returns true if any item in the stream fulfills the given predicate, false otherwise.
Returns a stream that has all its elements sorted according to the given compareFunc.
The comparison function is optional, the Array sort behavior will be used by default when
the function is omitted. The function must behave as expected by the Array.sort() method.
See also: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
NOTE: This function reads the entire stream into memory and stores all elements in an array to be able to sort it. This may be inefficient for very large datasets.
Like sort(), but sorts by comparing keys derived from the stream's items.
NOTE: This function reads the entire stream into memory and stores all elements in an array to be able to sort it. This may be inefficient for very large datasets.
Given an item, returns a sort key for comparison during sorting. This function should be fast, because it will be invoked at least once for every element.
OptionalcompareFunc: (leftKey: U, rightKey: U) => numberGiven two keys derived by keyFunc, returns < 0 if left < right, > 0 if right > left and 0 otherwise.
When not specified, keys are compared using standard < and > (which might be useless,
e.g. when keys are objects or arrays).
A new stream of sorted elements.
Gathers all elements of this stream into an array.
Gathers the elements of this stream into a map. The elements must be [key, value] pairs.
Note: elements are inserted into the map in the order they occur in the stream. Iterating over the map will yield the same order because maps maintain their insertion order.
Gathers all elements of this stream into a set.
Note: elements are inserted into the set in the order they occur in the stream. Iterating over the set will yield the same order because sets maintain their insertion order.
Returns a stream that consists of all elements of this stream, with duplicates removed. The relative order of the remaining elements is preserved.
NOTE: This function reads the entire stream into memory and stores all elements in a Set for de-duplication. This may be inefficient for very large datasets.
A new stream with unique items.
Zips the given iterables with this with the zipLongest algorithm (see static
zipLongest function for details).
The length of the resulting stream is the maximum length of all iterables, with empty
positions filled with undefined.
a series of iterables who's items will be zipped next to the items of this.
Zips the given iterables with this (see static zip function for details).
The length of the resulting stream is the minimum length of all iterables.
a series of iterables who's items will be zipped next to the items of this.
A stream is an iterable, lazy sequence of elements.