Skip to content

Dictionary

Defined in: package/src/classes/dictionary.ts:24

Extends

  • Map<K, V>

Type Parameters

Type Parameter

K

V

Constructors

new Dictionary()

new Dictionary<K, V>(entries?): Dictionary<K, V>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:50

Parameters

ParameterType

entries?

null | readonly readonly [K, V][]

Returns

Dictionary<K, V>

Inherited from

Map<K, V>.constructor

new Dictionary()

new Dictionary<K, V>(iterable?): Dictionary<K, V>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:49

Parameters

ParameterType

iterable?

null | Iterable<readonly [K, V], any, any>

Returns

Dictionary<K, V>

Inherited from

Map<K, V>.constructor

Properties

size

readonly size: number;

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:45

Returns

the number of elements in the Map.

Inherited from

Map.size

[toStringTag]

readonly [toStringTag]: string;

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137

Inherited from

Map.[toStringTag]

[species]

readonly static [species]: MapConstructor;

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319

Inherited from

Map.[species]

Methods

clear()

clear(): void

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:20

Returns

void

Inherited from

Map.clear

delete()

delete(key): boolean

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:24

Parameters

ParameterType

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

forEach()

forEach(callbackfn, thisArg?): void

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/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

ParameterType

callbackfn

(value, key, map) => void

thisArg?

any

Returns

void

Inherited from

Map.forEach

get()

get(key): undefined | V

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/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

ParameterType

key

K

Returns

undefined | 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

has()

has(key): boolean

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:37

Parameters

ParameterType

key

K

Returns

boolean

boolean indicating whether an element with the specified key exists or not.

Inherited from

Map.has

set()

set(key, value): this

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/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

ParameterType

key

K

value

V

Returns

this

Inherited from

Map.set

[iterator]()

iterator: MapIterator<[K, V]>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143

Returns an iterable of entries in the map.

Returns

MapIterator<[K, V]>

Inherited from

Map.[iterator]

entries()

entries(): MapIterator<[K, V]>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148

Returns an iterable of key, value pairs for every entry in the map.

Returns

MapIterator<[K, V]>

Inherited from

Map.entries

keys()

keys(): MapIterator<K>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153

Returns an iterable of keys in the map

Returns

MapIterator<K>

Inherited from

Map.keys

values()

values(): MapIterator<V>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158

Returns an iterable of values in the map

Returns

MapIterator<V>

Inherited from

Map.values

groupBy()

static groupBy<K, T>(items, keySelector): Map<K, T[]>

Defined in: docs/node_modules/.pnpm/typescript@5.7.3/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

Type Parameter

K

T

Parameters

ParameterTypeDescription

items

Iterable<T>

An iterable.

keySelector

(item, index) => K

A callback which will be invoked for each item in items.

Returns

Map<K, T[]>

Inherited from

Map.groupBy

filter()

filter(callback): Dictionary<K, V>

Defined in: package/src/classes/dictionary.ts:31

Filters the entries of the dictionary based on the provided callback.

Parameters

ParameterTypeDescription

callback

(value, key, dict) => boolean

A function to test each entry. Returns true to keep the entry, false otherwise.

Returns

Dictionary<K, V>

A new Dictionary with the filtered entries.


find()

find(callback): undefined | V

Defined in: package/src/classes/dictionary.ts:45

Finds the first value in the dictionary that satisfies the provided callback.

Parameters

ParameterTypeDescription

callback

(value, key, dict) => boolean

A function to test each entry. Returns true for the desired entry.

Returns

undefined | V

The first value that satisfies the callback, or undefined if none do.


every()

every(callback): boolean

Defined in: package/src/classes/dictionary.ts:63

Tests whether all entries in the dictionary pass the provided callback.

Parameters

ParameterTypeDescription

callback

(value, key, dict) => boolean

A function to test each entry. Returns true for entries that pass.

Returns

boolean

true if all entries pass the callback, otherwise false.


some()

some(callback): boolean

Defined in: package/src/classes/dictionary.ts:79

Tests whether at least one entry in the dictionary passes the provided callback.

Parameters

ParameterTypeDescription

callback

(value, key, dict) => boolean

A function to test each entry. Returns true for entries that pass.

Returns

boolean

true if at least one entry passes the callback, otherwise false.


reduce()

reduce<T>(callback, initial): T

Defined in: package/src/classes/dictionary.ts:96

Reduces the dictionary’s entries to a single value using the provided callback.

Type Parameters

Type Parameter

T

Parameters

ParameterTypeDescription

callback

(accumulator, value, key, dict) => T

A function to process each entry.

initial

T

The initial accumulator value.

Returns

T

The result of the reduction.


map()

map<T>(callback): Dictionary<K, T>

Defined in: package/src/classes/dictionary.ts:112

Maps the dictionary’s entries to a new Dictionary with transformed values.

Type Parameters

Type Parameter

T

Parameters

ParameterTypeDescription

callback

(value, key, dict) => T

A function to transform each entry.

Returns

Dictionary<K, T>

A new Dictionary with the mapped values.


first()

first(): undefined | V

Defined in: package/src/classes/dictionary.ts:125

Retrieves the first value in the dictionary.

Returns

undefined | V

The first value, or undefined if the dictionary is empty.


last()

last(): undefined | V

Defined in: package/src/classes/dictionary.ts:134

Retrieves the last value in the dictionary.

Returns

undefined | V

The last value, or undefined if the dictionary is empty.


clone()

clone(): Dictionary<K, V>

Defined in: package/src/classes/dictionary.ts:143

Creates a shallow copy of the dictionary.

Returns

Dictionary<K, V>

A new Dictionary instance with the same entries, limit, and name.