Function: cycle()
cycle<
Value
>(iterable
):Iterable
<Value
,any
,any
>
Returns an infinite iterable that repeatedly yields the values of iterable
in iteration order.
WARNING: This function does not buffer the values of iterable
for future
cycles. It reiterates iterable
each cycle.
Type Parameters
• Value
Parameters
iterable
Iterable
<Value
, any
, any
>
Returns
Iterable
<Value
, any
, any
>
Example
import { cycle, join, pipe, take } from 'lfi'
console.log(
pipe(
cycle([`sloth`, `lazy`]),
take(6),
join(`, `),
),
)
//=> sloth, lazy, sloth, lazy, sloth, lazy
Since
v0.0.1