Skip to content

Latest commit

 

History

History
191 lines (143 loc) · 7.56 KB

File metadata and controls

191 lines (143 loc) · 7.56 KB

Functions

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

Typedefs

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:

  • fill - value to fill the sequence
  • fn, init - function that generates sequence
  • from, to, step - range in which seqence is generated
SqncGenFunction*

callback function that will be invoked for each iteration

SqncGenInitFunctionObject

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

SqncIterator : Object

Iterator created by sqnc function

Kind: global typedef

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

sqncIterator.toArray([count]) ⇒ Array.<*>

convert sequence to Array

Kind: instance method of SqncIterator

Param Type Description
[count] number Limit count of iterations in constructed array

IteratorState : Object

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

SqncOptions : Object

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

SqncGenFunction ⇒ *

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

SqncGenInitFunction ⇒ Object

initializes state object that will be shared between iterations

Kind: global typedef
Returns: Object - object to store state between iterations