Generator yielding numbers from te first to the second argument included, if one argument is provided, start from 0 to the argumnet.
[...range(2, 3)] // [2, 3]
[...range(3)] // [0, 1, 2, 3]
Generator yielding an iterable (first argument) vaues one by one, infinitely, or a specified number of time (second argument)
[...cycle([2, 3], 2)] // [2, 3, 2, 3]
for (const x of cycle([2, 3])) // 2, 3, 2, 3, 2, 3... to Infinity
Take one function or many with iteratorHOFsPipe and return another function taking the source iterator. When iterated, the returned function will pass the source iterator values to each functions from the first argument and yield the mapped value.
function* dummyGen(n) {
let i = 0
while (i < n) {
yield i++
}
}
const double = x => x * 2
const it = iteratorHOF(double)(dummyGen)[Symbol.iterator](4)
[...it] // [0, 2, 4, 6]
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.