Similar to reduce_, but provides an iterator to the accumulated values.
Calls the reducer with an undefined accumulated value on the first value in the iterator to produce the initial value.
Similar to reduce, but provides an iterator over the accumulated values.
Yields the initial value first.
Returns true when all of the items in iterable are truthy. An optional key function can be used to define what truthiness means for the specific iterator.
Returns true when all of the items in iterable are truthy. An optional key function can be used to define what truthiness means for the specific iterator.
An iterator over multiple iterators in order.
Alternate to chain. Gets chained inputs from a single iterable argument that is evaluated lazily.
Iterates over the r-length subsequences of an iterable.
The combination tuples are emitted in lexicographic ordering according to the order of the input iterable. So, if the input iterable is sorted, the combination tuples will be produced in sorted order.
Elements are treated as unique based on their position, not on their value. So if the input elements are unique, there will be no repeat values in each combination.
Iterates over the r length subsequences of elements from the input iterable allowing individual elements to be repeated more than once.
The combination tuples are emitted in lexicographic ordering according to the order of the input iterable. So, if the input iterable is sorted, the combination tuples will be produced in sorted order.
Elements are treated as unique based on their position, not on their value. So if the input elements are unique, the generated combinations will also be unique.
Returns true when any of the items in the iterable are equal (===) to the target object.
Iterates the infinite sequence of start, start + step, start + 2 * step,...
Be careful to avoid calculating the entire sequence.
Defaults to start = 0
and step = 1
.
Make an iterator yielding elements from the iterable and saving a copy of each. When the iterable is exhausted, yields elements from the saved copy. Repeats indefinitely.
An iterator that drops elements from the passed iterable as long as the predicate is true; afterwards, returns every element. Note, the iterator does not produce any output until the predicate first becomes false, so it may have a lengthy start-up time.
Defaults to the truthyness of values for the predicate.
Returns a generator of enumeration pairs. Iterable must be an object which supports iteration. Produces tuples of the order of each element and the element itself.
Returns a generator that filters elements from a given iterable based on a predicate.
The predicate defaults to the boolean constructor; falsy values will be filtered.
An iterator that returns unique values and groups of that value from the iterable. Generally, the iterable needs to already be sorted.
The operation is similar to the uniq
filter in Unix. It generates a break
or new group every time the value changes (which is why it is usually
necessary to have sorted the data beforehand). This differs from SQL’s GROUP BY
which aggregates elements regardless of their input order.
The group iterator is not saved as the iterator progresses; please pay attention to the second example.
An iterator that returns consecutive keys and groups from the iterable. Generally, the iterable needs to already be sorted on the same key function.
The operation is similar to the uniq
filter in Unix. It generates a break
or new group every time the value of the key function changes (which is why
it is usually necessary to have sorted the data by the key function
beforehand). This differs from SQL’s GROUP BY
which aggregates common
elements regardless of their input order.
The group iterator is not saved as the iterator progresses; please pay attention to the second example.
A function computing a key value for each element.
An iterator that yields k elements from the iterable.
An iterator that yields selected elements from the iterable. If start
is
non-zero, then elements from the iterable are skipped until start is reached.
Afterward, elements are returned consecutively unless step is set higher than
one which results in items being skipped. Unlike regular slicing, islice()
does not support negative values for start, stop, or step.
Returns a generator over mapped elements from a given iterable based on a given modifying function.
An iterator over the r-length permutations of the iterable.
If r is undefined, then it defaults to the length of the iterable and all possible full-length permutations are generated.
The permutation tuples are emitted in lexicographic ordering according to the order of the input iterable. So, if the input iterable is sorted, the combination tuples will be produced in sorted order.
Elements are treated as unique based on their position, not on their value. So if the input elements are unique, there will be no repeat values in each permutation.
An iterator over the cartesian product of the input iterables.
Iterates over the values 0 <= i < end.
Returns an iterator producing all the numbers in the given range one by one,
starting from start
in increments of step
(defaults to 1) until end
is
reached.
When the step value is positive, the iterator will keep producing values as long as they are less than the end value.
When the step value is negative, the iterator will keep producing values as long as they are greater than the end value.
If the step value is 0, it will throw a TypeError
.
The range will be empty if the first value to produce already does not meet the value constraint.
Accumulates an iterator into a single value with a reducer function.
DISCLAIMER: it may be tempting to do the following:
reduce(stringIterator, (n, s) => n + s, '') // concatenate all strings
to concatenate a list of strings, however since strings are immutable in javascript, it is better to use the Array.prototype.join() function to avoid unnecessary copying of strings.
Same as reduce, but uses the first value from the iterable as the initial value.
An iterator that returns a target value over and over again. Runs indefinitely unless the times argument is specified.
Used as argument to map() for invariant parameters to the called function. Also used with zip() to create an invariant part of a tuple record.
The value to yield
The number of times to yield the value. Defaults to Infinity.
Iterates over the values of an iterator while they satisfy a predicate.
Defaults to the truthiness of values as the predicate.
Iterates over multiple iterators in parallel. Stops as soon as any of the included iterators stop.
Iterates over multiple iterators in parallel. Stops when all included
iterators stop. Yields undefined
for iterators that stop early.
Generated using TypeDoc
An iterator over the prefix sums of the number iterable.