MiniMap
Extends
Map
<K
,V
>
Type Parameters
Type Parameter |
---|
K |
V |
Constructors
new MiniMap()
new MiniMap<K, V>(data: [K, V][]): MiniMap<K, V>
Parameters
Parameter | Type | Default value |
---|---|---|
data | [K , V ][] | [] |
Returns
MiniMap
<K
, V
>
Inherited from
Map<K, V>.constructor
Defined in
Properties
Property | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
[toStringTag] | readonly | string | - | Map.[toStringTag] | docs/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137 |
constructor | public | MiniMapConstructor | The initial value of Object.prototype.constructor is the standard built-in Object constructor. | - | src/structures/Utils.ts:404 |
size | readonly | number | Map.size | docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:45 | |
[species] | readonly | MapConstructor | - | - | docs/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319 |
Methods
[iterator]()
iterator: MapIterator<[K, V]>
Returns an iterable of entries in the map.
Returns
MapIterator
<[K
, V
]>
Inherited from
Map.[iterator]
Defined in
docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143
clear()
clear(): void
Returns
void
Inherited from
Map.clear
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
delete()
delete(key: K): boolean
Parameters
Parameter | Type |
---|---|
key | K |
Returns
boolean
true if an element in the Map existed and has been removed, or false if the element does not exist.
Inherited from
Map.delete
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
entries()
entries(): MapIterator<[K, V]>
Returns an iterable of key, value pairs for every entry in the map.
Returns
MapIterator
<[K
, V
]>
Inherited from
Map.entries
Defined in
docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148
filter()
filter(fn)
filter<K2>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Type Parameter |
---|
K2 |
Parameters
Parameter | Type | Description |
---|---|---|
fn | (value : V , key : K , miniMap : this ) => key is K2 | The function to test with (should return boolean) |
Returns
MiniMap
<K2
, V
>
Example
miniMap.filter(user => user.username === 'Bob');
Defined in
filter(fn)
filter<V2>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>
Type Parameters
Type Parameter |
---|
V2 |
Parameters
Parameter | Type |
---|---|
fn | (value : V , key : K , miniMap : this ) => value is V2 |
Returns
MiniMap
<K
, V2
>
Defined in
filter(fn)
filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>
Parameters
Parameter | Type |
---|---|
fn | (value : V , key : K , miniMap : this ) => boolean |
Returns
MiniMap
<K
, V
>
Defined in
filter(fn, thisArg)
filter<This, K2>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>
Type Parameters
Type Parameter |
---|
This |
K2 |
Parameters
Parameter | Type |
---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => key is K2 |
thisArg | This |
Returns
MiniMap
<K2
, V
>
Defined in
filter(fn, thisArg)
filter<This, V2>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>
Type Parameters
Type Parameter |
---|
This |
V2 |
Parameters
Parameter | Type |
---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => value is V2 |
thisArg | This |
Returns
MiniMap
<K
, V2
>
Defined in
filter(fn, thisArg)
filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>
Type Parameters
Type Parameter |
---|
This |
Parameters
Parameter | Type |
---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => boolean |
thisArg | This |
Returns
MiniMap
<K
, V
>
Defined in
forEach()
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void
Executes a provided function once per each key/value pair in the Map, in insertion order.
Parameters
Parameter | Type |
---|---|
callbackfn | (value : V , key : K , map : Map <K , V >) => void |
thisArg ? | any |
Returns
void
Inherited from
Map.forEach
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:28
get()
get(key: K): V
Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
Parameters
Parameter | Type |
---|---|
key | K |
Returns
V
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
Inherited from
Map.get
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:33
has()
has(key: K): boolean
Parameters
Parameter | Type |
---|---|
key | K |
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Map.has
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
keys()
keys(): MapIterator<K>
Returns an iterable of keys in the map
Returns
MapIterator
<K
>
Inherited from
Map.keys
Defined in
docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153
map()
map(fn)
map<T>(fn: (value: V, key: K, miniMap: this) => T): T[]
Maps each item to another value into an array. Identical in behavior to Array.map().
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type | Description |
---|---|---|
fn | (value : V , key : K , miniMap : this ) => T | Function that produces an element of the new array, taking three arguments |
Returns
T
[]
Example
miniMap.map(user => user.tag);
Defined in
map(fn, thisArg)
map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[]
Type Parameters
Type Parameter |
---|
This |
T |
Parameters
Parameter | Type |
---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => T |
thisArg | This |
Returns
T
[]
Defined in
set()
set(key: K, value: V): this
Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
Parameters
Parameter | Type |
---|---|
key | K |
value | V |
Returns
this
Inherited from
Map.set
Defined in
docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:41
toJSON()
toJSON(): [K, V][]
Returns
[K
, V
][]
Defined in
values()
values(): MapIterator<V>
Returns an iterable of values in the map
Returns
MapIterator
<V
>
Inherited from
Map.values
Defined in
docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158
groupBy()
static groupBy<K, T>(items: Iterable<T, any, any>, keySelector: (item: T, index: number) => K): Map<K, T[]>
Groups members of an iterable according to the return value of the passed callback.
Type Parameters
Type Parameter |
---|
K |
T |
Parameters
Parameter | Type | Description |
---|---|---|
items | Iterable <T , any , any > | An iterable. |
keySelector | (item : T , index : number ) => K | A callback which will be invoked for each item in items. |
Returns
Map
<K
, T
[]>
Defined in
docs/node_modules/typescript/lib/lib.esnext.collection.d.ts:25