MiniMap
Defined in: src/structures/Utils.ts:426
Extends
Section titled “Extends”Map
<K
,V
>
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
K |
V |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MiniMap<K, V>(data: [K, V][]): MiniMap<K, V>;
Defined in: src/structures/Utils.ts:431
Parameters
Section titled “Parameters”Parameter | Type | Default value |
---|---|---|
data | [K , V ][] | [] |
Returns
Section titled “Returns”MiniMap
<K
, V
>
Inherited from
Section titled “Inherited from”Map<K, V>.constructor
Properties
Section titled “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:427 |
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
Section titled “Methods”[iterator]()
Section titled “[iterator]()”iterator: MapIterator<[K, V]>;
Defined in: docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143
Returns an iterable of entries in the map.
Returns
Section titled “Returns”MapIterator
<[K
, V
]>
Inherited from
Section titled “Inherited from”Map.[iterator]
clear()
Section titled “clear()”clear(): void;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Map.clear
delete()
Section titled “delete()”delete(key: K): boolean;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
key | K |
Returns
Section titled “Returns”boolean
true if an element in the Map existed and has been removed, or false if the element does not exist.
Inherited from
Section titled “Inherited from”Map.delete
entries()
Section titled “entries()”entries(): MapIterator<[K, V]>;
Defined in: docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148
Returns an iterable of key, value pairs for every entry in the map.
Returns
Section titled “Returns”MapIterator
<[K
, V
]>
Inherited from
Section titled “Inherited from”Map.entries
filter()
Section titled “filter()”Call Signature
Section titled “Call Signature”filter<K2>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
Defined in: src/structures/Utils.ts:446
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
K2 |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (value : V , key : K , miniMap : this ) => key is K2 | The function to test with (should return boolean) |
Returns
Section titled “Returns”MiniMap
<K2
, V
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
Call Signature
Section titled “Call Signature”filter<V2>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
Defined in: src/structures/Utils.ts:447
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
V2 |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (value : V , key : K , miniMap : this ) => value is V2 | The function to test with (should return boolean) |
Returns
Section titled “Returns”MiniMap
<K
, V2
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
Call Signature
Section titled “Call Signature”filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
Defined in: src/structures/Utils.ts:448
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (value : V , key : K , miniMap : this ) => boolean | The function to test with (should return boolean) |
Returns
Section titled “Returns”MiniMap
<K
, V
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
Call Signature
Section titled “Call Signature”filter<This, K2>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
Defined in: src/structures/Utils.ts:449
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
This |
K2 |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => key is K2 | The function to test with (should return boolean) |
thisArg | This | Value to use as this when executing function |
Returns
Section titled “Returns”MiniMap
<K2
, V
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
Call Signature
Section titled “Call Signature”filter<This, V2>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
Defined in: src/structures/Utils.ts:453
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
This |
V2 |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => value is V2 | The function to test with (should return boolean) |
thisArg | This | Value to use as this when executing function |
Returns
Section titled “Returns”MiniMap
<K
, V2
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
Call Signature
Section titled “Call Signature”filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
Defined in: src/structures/Utils.ts:457
Identical to Array.filter(), but returns a MiniMap instead of an Array.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
This |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => boolean | The function to test with (should return boolean) |
thisArg | This | Value to use as this when executing function |
Returns
Section titled “Returns”MiniMap
<K
, V
>
Example
Section titled “Example”miniMap.filter(user => user.username === 'Bob');
forEach()
Section titled “forEach()”forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:28
Executes a provided function once per each key/value pair in the Map, in insertion order.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
callbackfn | (value : V , key : K , map : Map <K , V >) => void |
thisArg? | any |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Map.forEach
get(key: K): V;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:33
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
Section titled “Parameters”Parameter | Type |
---|---|
key | K |
Returns
Section titled “Returns”V
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
Inherited from
Section titled “Inherited from”Map.get
has(key: K): boolean;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
key | K |
Returns
Section titled “Returns”boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Section titled “Inherited from”Map.has
keys()
Section titled “keys()”keys(): MapIterator<K>;
Defined in: docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153
Returns an iterable of keys in the map
Returns
Section titled “Returns”MapIterator
<K
>
Inherited from
Section titled “Inherited from”Map.keys
Call Signature
Section titled “Call Signature”map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
Defined in: src/structures/Utils.ts:481
Maps each item to another value into an array. Identical in behavior to Array.map().
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T |
Parameters
Section titled “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
Section titled “Returns”T
[]
Example
Section titled “Example”miniMap.map(user => user.tag);
Call Signature
Section titled “Call Signature”map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
Defined in: src/structures/Utils.ts:482
Maps each item to another value into an array. Identical in behavior to Array.map().
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
This |
T |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
fn | (this : This , value : V , key : K , miniMap : this ) => T | Function that produces an element of the new array, taking three arguments |
thisArg | This | Value to use as this when executing function |
Returns
Section titled “Returns”T
[]
Example
Section titled “Example”miniMap.map(user => user.tag);
set(key: K, value: V): this;
Defined in: docs/node_modules/typescript/lib/lib.es2015.collection.d.ts:41
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
Section titled “Parameters”Parameter | Type |
---|---|
key | K |
value | V |
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Map.set
toJSON()
Section titled “toJSON()”toJSON(): [K, V][];
Defined in: src/structures/Utils.ts:467
Returns
Section titled “Returns”[K
, V
][]
values()
Section titled “values()”values(): MapIterator<V>;
Defined in: docs/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158
Returns an iterable of values in the map
Returns
Section titled “Returns”MapIterator
<V
>
Inherited from
Section titled “Inherited from”Map.values
groupBy()
Section titled “groupBy()”static groupBy<K, T>(items: Iterable<T>, keySelector: (item: T, index: number) => K): Map<K, T[]>;
Defined in: docs/node_modules/typescript/lib/lib.es2024.collection.d.ts:25
Groups members of an iterable according to the return value of the passed callback.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
K |
T |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
items | Iterable <T > | An iterable. |
keySelector | (item : T , index : number ) => K | A callback which will be invoked for each item in items. |
Returns
Section titled “Returns”Map
<K
, T
[]>