Generate a sequence of numbers
$> npm install --save step-generator
$> npm test
Generate a sequence of stepping numbers.
const stepGenerator = require('step-generator')
const evenGenerator = stepGenerator({ start: 2, step: 2 })
const evens = [
evenGenerator.next().value,
evenGenerator.next().value,
evenGenerator.next().value,
evenGenerator.next().value,
]
console.log(evens)
Output
[2, 4, 6, 8]