Number of integers to yield
Added to result
const a = [...count(5)]; // Yields five numbers: [0,1,2,3,4]
const b = [...count(-5)]; // Yields five numbers: [0,-1,-2,-3,-4]
for (const v of count(5, 5)) {
// Yields: 5, 6, 7, 8, 9
}
const c = [...count(5,1)]; // Yields [1,2,3,4,5]
// Prints `Hi` 5x
forEach(count(5), () => // do something);
If you want to accumulate return values, consider using Flow.repeat.
import { interval } from 'https://unpkg.com/ixfx/dist/flow.js'
import { count } from 'https://unpkg.com/ixfx/dist/numbers.js'
const counter = count(10);
for await (const v of interval(counter, { fixedIntervalMs: 100 })) {
// Do something
}
Yields
amount
integers, counting by one from zero. If a negative amount is used, count decreases. Ifoffset
is provided, this is added to the return result.