Skip to main content

Function: cycle()

cycle<Value>(iterable): Iterable<Value, any, any>

Returns an infinite iterable that repeatedly yields the values of iterable in iteration order.

Type Parameters

Value

Parameters

iterable: Iterable<Value, any, any>

Returns

Iterable<Value, any, any>

Example

console.log(
pipe(
cycle([`sloth`, `more sloth`]),
take(6),
join(`, `),
),
)
//=> sloth, more sloth, sloth, more sloth, sloth, more sloth

Defined in

generators.d.ts:147