stepByStep()
Performs a callback function with the ability to decide when to move to the next step of the range
Range.prototype.stepByStep()
Range.prototype.stepByStep()public stepByStep(
callbackFn: (value: Generator<number>, step: Step, max: Max) => void
): this {
const t = this;
callbackFn(
(function* stepByStep(current = t.min - t.step): Generator<number> {
while (current < t.max) {
yield (current += t.step);
}
})(),
t.step,
t.max
);
return this;
}Parameters
Return type
Returns
Example usage
Last updated