Creates an Iterable that emits a sequence of values computed by a Mapper function, starting with a seed value. The sequence ends when the hasNext Predicate returns false.
seed
hasNext
false
Iterate from 1 to 3
1
3
const iterable = iterate( 1, x => x + 1, x => x < 3);console.log(iterable); // [1, 2, 3]
generate for similar operations.
the Iterable value type
the first value of the sequence
the Mapper function to compute the next value
the Predicate to check if there's a next value
Generated using TypeDoc
Creates an Iterable that emits a sequence of values computed by a Mapper function, starting with a
seedvalue. The sequence ends when thehasNextPredicate returnsfalse.Example
Iterate from
1to3See
generate for similar operations.