Class: ObjectIterator

sjl.stdlib. ObjectIterator


new ObjectIterator(keysOrObj, values)

Parameters:
Name Type Description
keysOrObj Array | Object Array of keys or object to create (object) iterator from.
values Array | Undefined Array of values if first param is an array.

Extends

Members


<readonly> _values :Array.<*>

Iterator values. Set on construction.
Type:
  • Array.<*>
Inherited From:

pointer :Number

Iterator pointer.
Type:
  • Number
Inherited From:

<readonly> size :Number

Iterator size.
Type:
  • Number
Inherited From:

Methods


current()

Returns the current value that `pointer` is pointing to.
Inherited From:
Returns:
Type
Object

forEach(callback, context)

Iterates through all elements in iterator.
Parameters:
Name Type Description
callback function
context Object
Inherited From:
Returns:
Type
sjl.stdlib.Iterator

next()

Method which returns the current position in the iterator based on where the pointer is. This method also increases the pointer after it is done fetching the value to return.
Inherited From:
Returns:
Type
Object

rewind()

Rewinds the iterator.
Inherited From:
Returns:
Type
sjl.stdlib.Iterator

valid()

Returns whether the iterator has reached it's end.
Inherited From:
Returns:
Type
boolean