Appearance
Class: EnhancedMap<K, V>
Defined in: src/collections.ts:777
Enhanced Map class with additional collection-like methods. Extends the native Map class.
Extends
Map<K,V>
Type Parameters
K
K
V
V
Constructors
Constructor
new EnhancedMap<
K,V>(entries?):EnhancedMap<K,V>
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:51
Parameters
entries?
readonly readonly [K, V][] | null
Returns
EnhancedMap<K, V>
Inherited from
Map<K, V>.constructor
Constructor
new EnhancedMap<
K,V>(iterable?):EnhancedMap<K,V>
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:50
Parameters
iterable?
Iterable<readonly [K, V], any, any> | null
Returns
EnhancedMap<K, V>
Inherited from
Map<K, V>.constructor
Methods
fromObject()
staticfromObject<V>(obj):EnhancedMap<string,V>
Defined in: src/collections.ts:784
Create an EnhancedMap from a plain object.
Type Parameters
V
V
Parameters
obj
Record<string, V>
The object to convert
Returns
EnhancedMap<string, V>
A new EnhancedMap instance
pluck()
pluck<
P>(key):EnhancedArray<V[P]>
Defined in: src/collections.ts:794
Pluck a property from each value in the map.
Type Parameters
P
P extends string | number | symbol
Parameters
key
P
The key to pluck
Returns
EnhancedArray<V[P]>
A new collection of plucked values
groupBy()
groupBy(
accessor):Record<string,EnhancedArray<[K,V]>>
Defined in: src/collections.ts:808
Group the map's entries by a given accessor.
Parameters
accessor
(value, key) => string | number
The accessor to group by
Returns
Record<string, EnhancedArray<[K, V]>>
A record of grouped entries
toArray()
toArray():
EnhancedArray<[K,V]>
Defined in: src/collections.ts:829
Convert the map to an array of entries.
Returns
EnhancedArray<[K, V]>
A collection of entries
toObject()
toObject():
Record<string,V>
Defined in: src/collections.ts:838
Convert the map to a plain object.
Returns
Record<string, V>
A plain object representation of the map