Function
Static Public Summary | ||
public |
Repeats the input item a few times. |
|
public |
Repeats the input item endlessly. |
Static Public
public * nrepeat(item: any, times: Number): IterableIterator source
import nrepeat from '@iterable-iterator/repeat/src/nrepeat.js'
Repeats the input item a few times. Returns an iterator that yields the input item a fixed number of times.
Params:
Name | Type | Attribute | Description |
item | any | The input item. |
|
times | Number | The number of times to yield |
Return:
IterableIterator |
Example:
list( nrepeat( 6 , 3 ) ) ; // returns [ 6 , 6 , 6 ]
public * repeat(item: Object): Iterator source
import repeat from '@iterable-iterator/repeat/src/repeat.js'
Repeats the input item endlessly. Returns an iterator that yields the input item over and over again.
Params:
Name | Type | Attribute | Description |
item | Object | The input item. |
Return:
Iterator |
Example:
list( take( repeat( 6 ) , 3 ) ) ; // returns [ 6 , 6 , 6 ]