Skip to content

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

ParameterTypeDefault value
data[K, V][][]

Returns

MiniMap<K, V>

Inherited from

Map<K, V>.constructor

Defined in

src/structures/Utils.ts:408

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
[toStringTag]readonlystring-Map.[toStringTag]docs/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137
constructorpublicMiniMapConstructorThe initial value of Object.prototype.constructor is the standard built-in Object constructor.-src/structures/Utils.ts:404
sizereadonlynumberMap.sizedocs/node_modules/typescript/lib/lib.es2015.collection.d.ts:45
[species]readonlyMapConstructor--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

ParameterType
keyK

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
ParameterTypeDescription
fn(value: V, key: K, miniMap: this) => key is K2The function to test with (should return boolean)
Returns

MiniMap<K2, V>

Example
miniMap.filter(user => user.username === 'Bob');
Defined in

src/structures/Utils.ts:423

filter(fn)

filter<V2>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>
Type Parameters
Type Parameter
V2
Parameters
ParameterType
fn(value: V, key: K, miniMap: this) => value is V2
Returns

MiniMap<K, V2>

Defined in

src/structures/Utils.ts:424

filter(fn)

filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>
Parameters
ParameterType
fn(value: V, key: K, miniMap: this) => boolean
Returns

MiniMap<K, V>

Defined in

src/structures/Utils.ts:425

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
ParameterType
fn(this: This, value: V, key: K, miniMap: this) => key is K2
thisArgThis
Returns

MiniMap<K2, V>

Defined in

src/structures/Utils.ts:426

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
ParameterType
fn(this: This, value: V, key: K, miniMap: this) => value is V2
thisArgThis
Returns

MiniMap<K, V2>

Defined in

src/structures/Utils.ts:430

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
ParameterType
fn(this: This, value: V, key: K, miniMap: this) => boolean
thisArgThis
Returns

MiniMap<K, V>

Defined in

src/structures/Utils.ts:434


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

ParameterType
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

ParameterType
keyK

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

ParameterType
keyK

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
ParameterTypeDescription
fn(value: V, key: K, miniMap: this) => TFunction that produces an element of the new array, taking three arguments
Returns

T[]

Example
miniMap.map(user => user.tag);
Defined in

src/structures/Utils.ts:458

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
ParameterType
fn(this: This, value: V, key: K, miniMap: this) => T
thisArgThis
Returns

T[]

Defined in

src/structures/Utils.ts:459


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

ParameterType
keyK
valueV

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

src/structures/Utils.ts:444


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

ParameterTypeDescription
itemsIterable<T, any, any>An iterable.
keySelector(item: T, index: number) => KA 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