Class HashArray<T>
Type Parameters
Index
Constructors
Accessors
Methods
Properties
Constructors
constructor
- new HashArray<T extends object>(
keyFields?: string | KeyFields,
options?: HashArrayOptions<T>,
): HashArray<T> Type Parameters
Parameters
Optional
keyFields: string | KeyFieldsA single string or an array of strings / arrays representing what fields on added objects are to be used as keys for the trie search / HashArray.
Optional
options: HashArrayOptions<T>Options.
Returns HashArray<T>
Accessors
keyFields
size
- get size(): number
Returns number
The mapped size; number of keys in HashArray.
sizeFlat
- get sizeFlat(): number
Returns number
The flattened size; number of items in HashArray.
Methods
add
clear
clone
- clone(opts?: { items?: CloneOps; options?: HashArrayOptions<T> }): HashArray<T>
Clones this HashArray. By default, returning an empty HashArray with cloned KeyFields. Set
items
in options toCloneOps.SHALLOW
to copy the items. To fully clone all items setCloneOps.DEEP
.Parameters
Optional
opts: { items?: CloneOps; options?: HashArrayOptions<T> }Optional parameters.
Optional
items?: CloneOpsClone operation for items. By default, no items are included in the clone. Supply
SHALLOW
and items are copied. SupplyDEEP
and items are cloned as well.Optional
options?: HashArrayOptions<T>Optional change to options for the clone that is merged with current HashArray options.
Returns HashArray<T>
collides
entries
- entries(): IterableIterator<[string, T[]], any, any>
Returns IterableIterator<[string, T[]], any, any>
An entries iterator w/ key and all associated values.
entriesFlat
- entriesFlat(): IterableIterator<[string, T], any, any>
Returns IterableIterator<[string, T], any, any>
Generator of flattened entries.
filter
forEach
forEachDeep
get
getAll
getAsArray
getAt
has
intersection
keys
- keys(): IterableIterator<string, any, any>
Returns IterableIterator<string, any, any>
A keys iterator.
remove
removeByKey
removeFirst
removeLast
values
- values(): IterableIterator<T[], any, any>
Returns IterableIterator<T[], any, any>
A values iterator / all items values grouped by key.
valuesFlat
- valuesFlat(): IterableIterator<T, any, any>
Returns IterableIterator<T, any, any>
A flat values iterator by default in order added.
Properties
Static
Readonly
CloneOps
An enum used in HashArray.clone determining how items are handled.
HashArray is a data structure that combines the best feature of a hash (O(1) retrieval) and an array (length and ordering). Think of it as a super-lightweight, extensible, self-indexing set database in memory.