Constructor
new IterableCollection()
Creates an empty collection with a starting internal index `_i` of 0
- Source:
Methods
#[Symbol.iterator]() → {IterableCollectionItem}
This symbolic iterator is what makes this collection unique.
It is a generator function that yields an object containing
the index key descriptor and the item
- Source:
Yields:
- Type
- IterableCollectionItem
add(item) → {number}
Adds item to the collection. Uses the getIndex
method to control the key descriptor. Returns the index
of the added item.
Parameters:
Name | Type | Description |
---|---|---|
item |
any |
- Source:
Returns:
index
- Type
- number
getIndex() → {number}
Returns the current `_i` value and then increments it
- Source:
Returns:
index
- Type
- number
length() → {number}
Returns the number of instances in the collection
- Source:
Returns:
length
- Type
- number