Returns false
and terminates the generator if the predicate is false for any of the generator's
yielded values.
If the generator terminates without having failed the predicate, true
is returned.
predicate to apply to each yielded value.
Optional value to supply as context (this
) for the predicate
Returns false
and terminates this generator if the predicate is false for any of the generator's
yielded values.
If the generator terminates without having failed the predicate, true
is returned.
predicate to apply to each yielded value.
Returns false
and terminates this generator if the predicate is false for any of the generator's
yielded values.
If the generator terminates without having failed the predicate, true
is returned.
predicate to apply to each yielded value.
the generator
Returns false
and terminates this generator if the predicate is false for any of the generator's
yielded values.
If the generator terminates without having failed the predicate, true
is returned.
predicate to apply to each yielded value.
Optional value to supply as context (this
) for the predicate
the generator
Return a functionthat filters a Genable and yields a new EnhancedGenerator that yields only the values that satisfy the predicate f.
f receives the value and a sequential index.
the type of value.
Return a functionthat filters a Genable and yields a new EnhancedGenerator that yields only the values that satisfy the predicate f.
f receives the value and a sequential index.
the type of value.
Optional context to be passed as this
to the predicate.
Return a new EnhancedGenerator that yields only the values that satisfy the predicate f.
f receives the value and a sequential index.
the type of value.
Return a new EnhancedGenerator that yields only the values that satisfy the predicate f.
f receives the value and a sequential index.
the type of value.
Optional context to be passed as this
to the predicate.
a Genable
Flatten the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by applying the function to the values yielded by the generator to level depth. Produces a function that accepts a generator, and returns another generator that yields the individual value at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by applying the function to the values yielded by the generator to level depth. Produces a function that accepts a generator, and returns another generator that yields the individual value at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by applying the function to the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Flatten the values yielded by applying the function to the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.
The return type is currently over-broad
Operate on each value produced by the generator. f is called with two values, the value yielded by this generator and a sequential index.
the type of value produced by the generator.
Optional value to be supplied as context this
for function f.
the generator.
Operate on each value produced by the generator. f is called with two values, the value yielded by this generator and a sequential index.
the type of value produced by the generator.
the generator.
Operate on each value produced by the generator. f is called with two values, the value yielded by this generator and a sequential index.
the type of value produced by the generator.
Optional value to be supplied as context this
for function f.
Operate on each value produced by the generator. f is called with two values, the value yielded by this generator and a sequential index.
the type of value produced by the generator.
Returns a function that joins the elements produced by a Genable, analogous to Array.prototype.join
.
(default = ',')
Joins the elements produced by a Genable, analogous to Array.prototype.join
.
Limit the number of values that can be generated. A RangeError
is thrown if this limit is
exceeded. See EnhancedGenerator.slice if you want to truncate.
Limit the number of values that can be generated. A RangeError
is thrown if this limit is
exceeded. See EnhancedGenerator.slice if you want to truncate.
Accepts a function from T
to V, and returns a function that adapts a
Generator(or any [Genable|Genable\\<T>]) to an enhanced
Generator. Each yielded value V is the result of applying the function
fto to a value yielded by the
Generator
In the async case, f
may also return Promise<T>
.
the type of value yielded by the supplied generator.
the type of value yielded by the resulting generator.
a function from V
to T
Accepts a function from T
to V, and returns a function that adapts a
Generator(or any [Genable|Genable\\<T>]) to an enhanced
Generator. Each yielded value V is the result of applying the function
fto to a value yielded by the
Generator
In the async case, f
may also return Promise<T>
.
the type of value produced by the generator.
the type of value yielded by the resulting generator.
supplied as 'this' for each invocation of f
.
Accepts a function from T
to V, and a
Generator(or any [Genable|Genable\\<T>]) and returns an enhanced
Generator
Each yielded value V is
the result of applying the function f
to to a value yielded by the Generator<T>
.
In the async case, f
may also return Promise<T>
.
the type of value produced by the generator.
the type of value yielded by the resulting generator.
Accepts a function from T
to V, and a
Generator(or any [Genable|Genable\\<T>]) and returns an enhanced
Generator
Each yielded value V is
the result of applying the function f
to to a value yielded by the Generator<T>
.
In the async case, f
may also return Promise<T>
.
the type of value produced by the generator.
the type of value yielded by the resulting generator.
supplied as 'this' for each invocation of f
.
the Genable whose yielded values we are mapping over.
Return a generator that provides the supplied values.
Reduces gen like Array.prototype.reduce
, but the 3rd argument to the reducing function ("array")
is omitted because there is no array.
Returns a reducer function that, when applied to a Generator
gen, reduces gen like
Array.prototype.reduce. The 3rd argument to the reducing function ("array")
is omitted because there is no array.
Returns a reducer function that, when applied to a Generator
gen, reduces gen like
Array.prototype.reduce
. The 3rd argument to the reducing function ("array")
is omitted because there is no array.
Reduces gen like Array.prototype.reduce
, but the 3rd argument to the reducing function ("array")
is omitted because there is no array.
Returns a reducer function that, when applied to a Generator
gen, reduces gen like
Array.prototype.reduce
. The 3rd argument to the reducing function ("array")
is omitted because there is no array.
Alternatively, the init value can be supplied along with the generator as a second argument.
Returns a new generator that repeats the supplied value.
the value to repeat
The number repetitions; the default is infinite.
Return a new EnhancedGenerator that only yields the indicated values, skipping start initial values and continuing until the end.
Return a new EnhancedGenerator that only yields the indicated values, skipping start initial values and continuing until the end.
Returns true
and terminates the generator if the predicate is true for any of the generator's
yielded values.
If the generator terminates without having satisfied the predicate, false
is returned.
predicate to apply to each yielded value.
Optional value to supply as context (this
) for the predicate
Returns true
and terminates the generator if the predicate is true for any of the generator's
yielded values.
If the generator terminates without having satisfied the predicate, false
is returned.
predicate to apply to each yielded value.
Returns true
and terminates the generator if the predicate is true for any of the generator's
yielded values.
If the generator terminates without having satisfied the predicate, false
is returned.
predicate to apply to each yielded value.
the generator
Returns true
and terminates the generator if the predicate is true for any of the generator's
yielded values.
If the generator terminates without having satisfied the predicate, false
is returned.
predicate to apply to each yielded value.
Optional value to supply as context (this
) for the predicate
the generator
Combines generators, returning a generator that produces a tuple with each of their results.
Terminates when the first generator terminates. To get other behaviors, use with EnhancedGenerator.repeat or EnhancedGenerator.repeatLast.
Generated using TypeDoc
Concatenates generators (or iterators or iterables).
Ensures that any supplied generators are terminated when this is terminated.