Function
Static Public Summary | ||
public |
* cycle(iterable: Iterable): IterableIterator Cycles through the input iterable. |
|
public |
Same as cycle but only cycles a limited number of times. |
Static Public
public * cycle(iterable: Iterable): IterableIterator source
import cycle from '@iterable-iterator/cycle/src/cycle.js'
Cycles through the input iterable.
Params:
Name | Type | Attribute | Description |
iterable | Iterable | The input iterable. |
Return:
IterableIterator |
Example:
// returns [0,1,0,1,0,1,0]
list(head(cycle(range(2)),7)) ;
public * ncycle(iterable: Iterable, n: Number): Iterator source
import ncycle from '@iterable-iterator/cycle/src/ncycle.js'
Same as cycle but only cycles a limited number of times.
Params:
Name | Type | Attribute | Description |
iterable | Iterable | The input iterable. |
|
n | Number | The number of times to cycle through the input iterable. |
Return:
Iterator |
Example:
// returns [0,1,0,1,0,1,0,1]
list(ncycle(range(2),4)) ;