- sqnc(options) ⇒
SqncIterator Create sequence iterator with set of options
- sqnc(fill) ⇒
SqncIterator Create SqncIterator that will return only one value for each iteration specified by fill param
- sqnc(fn, [count]) ⇒
SqncIterator Create sequence iterator with generation function
- sqnc(from, to, [step], [count]) ⇒
SqncIterator Create sequence iterator with range of values
- SqncIterator :
Object Iterator created by sqnc function
- IteratorState :
Object Object that describes current iterator state, check out Iterable protocol
- SqncOptions :
Object Options to instantiate sequence interator, one of its groups of params will be used, by priority:
- SqncGenFunction ⇒
* callback function that will be invoked for each iteration
- SqncGenInitFunction ⇒
Object initializes state object that will be shared between iterations
sqnc(options) ⇒ SqncIterator
Create sequence iterator with set of options
Kind: global function
Returns: SqncIterator - iterator
| Param | Type | Description |
|---|---|---|
| options | SqncOptions |
sequence options |
sqnc(fill) ⇒ SqncIterator
Create SqncIterator that will return only one value for each iteration specified by fill param
Kind: global function
Returns: SqncIterator - iterator
| Param | Type | Description |
|---|---|---|
| fill | number | string |
value that will be returned by every iteration of iterator |
sqnc(fn, [count]) ⇒ SqncIterator
Create sequence iterator with generation function
Kind: global function
Returns: SqncIterator - iterator
| Param | Type | Description |
|---|---|---|
| fn | SqncGenFunction |
sequence generation function |
| [count] | number |
limit iterations count |
sqnc(from, to, [step], [count]) ⇒ SqncIterator
Create sequence iterator with range of values
Kind: global function
Returns: SqncIterator - iterator
| Param | Type | Default | Description |
|---|---|---|---|
| from | number | string |
first value within iteration range | |
| to | number | string |
value to limit iteration range | |
| [step] | number |
1 |
step within iteration range |
| [count] | number |
limit iterations count |
Iterator created by sqnc function
Kind: global typedef
- SqncIterator :
Object- .next() ⇒
IteratorState - .instance([count]) ⇒
SqncIterator - .toArray([count]) ⇒
Array.<*>
- .next() ⇒
sqncIterator.next() ⇒ IteratorState
Do increment and return next state of iterator
Kind: instance method of SqncIterator
sqncIterator.instance([count]) ⇒ SqncIterator
Create SqncIterator with the same SqncOptions as source
Kind: instance method of SqncIterator
| Param | Type | Description |
|---|---|---|
| [count] | number |
Limit count of iterations in constructed instance |
convert sequence to Array
Kind: instance method of SqncIterator
| Param | Type | Description |
|---|---|---|
| [count] | number |
Limit count of iterations in constructed array |
Object that describes current iterator state, check out Iterable protocol
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| done | boolean |
is true if iterator is past the end of the iterated sequence. |
| value | * |
value returned by iterator for the current step |
Options to instantiate sequence interator, one of its groups of params will be used, by priority:
- fill - value to fill the sequence
- fn, init - function that generates sequence
- from, to, step - range in which seqence is generated
Kind: global typedef
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| fill | * |
- | |
| from | number | string |
first value within iteration range | |
| [to] | number | string |
value to limit iteration range | |
| [step] | number |
1 |
step within iteration range |
| fn | SqncGenFunction |
function that generates sequence | |
| init | SqncGenInitFunction |
function that will be called before first call of fn to initialize state object that will be shared between iterations | |
| count | number |
limit iterations count |
callback function that will be invoked for each iteration
Kind: global typedef
Returns: * - value of current iteration
| Param | Type | Description |
|---|---|---|
| idx | number |
index of current iteration |
| state | Object |
object to store state between iterations |
| end | function |
should be called to end sequence before idx reaches the limit |
initializes state object that will be shared between iterations
Kind: global typedef
Returns: Object - object to store state between iterations