Type Alias: RangeIterable
RangeIterable =
Iterable
<number
> &object
Defined in: generators.d.ts:361
An iterable that yields integers in a range.
See RangeIterable.step for obtaining a new iterable that skips integers in steps.
Type declaration
step()
step: <
Step
>(step
) =>Iterable
<number
>
Returns an iterable that yields integers in the same range as the original
RangeIterable, but steps through the range in increments of step
instead of 1.
Type Parameters
Step
Step
extends number
Parameters
step
PositiveInteger
<Step
>
Returns
Iterable
<number
>
Throws
if step
is not a positive integer.
Example
import { join, pipe, rangeTo } from 'lfi'
console.log(
pipe(
rangeTo(0, 6).step(2),
join(`, `),
),
)
//=> 0, 2, 4, 6
Since
v2.0.0