Creates an infinite (or finite) Sequence by repeatedly applying next to a seed value. The sequence ends when next returns null or undefined.
Sequence
next
null
undefined
The element type.
The first value in the sequence.
Called with the current value; returning null/undefined ends the sequence.
generate(1, n => n < 8 ? n * 2 : null).toArray(); // [1, 2, 4, 8] Copy
generate(1, n => n < 8 ? n * 2 : null).toArray(); // [1, 2, 4, 8]
Creates an infinite (or finite)
Sequenceby repeatedly applyingnextto a seed value. The sequence ends whennextreturnsnullorundefined.