Skip to content

Documentation / @cashconnect-js/core / primitives/utils

ExtMap

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:48

Extends

  • Map<PropertyKey, T>

Extended by

Type Parameters

Type Parameter
T

Constructors

Constructor

ts
new ExtMap<T>(entries?): ExtMap<T>;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:50

Parameters
ParameterType
entries?readonly readonly [PropertyKey, T][] | null
Returns

ExtMap<T>

Inherited from
ts
Map<PropertyKey, T>.constructor

Constructor

ts
new ExtMap<T>(iterable?): ExtMap<T>;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:49

Parameters
ParameterType
iterable?Iterable<readonly [PropertyKey, T], any, any> | null
Returns

ExtMap<T>

Inherited from
ts
Map<PropertyKey, T>.constructor

Methods

fromArray()

ts
static fromArray<T, K>(array, keySelector): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:52

Creates a new ExtMap from an array using a key selector

Type Parameters
Type Parameter
T
K extends PropertyKey
Parameters
ParameterType
arrayreadonly T[]
keySelector(item) => K
Returns

ExtMap<T>

fromObject()

ts
static fromObject<T>(object): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:64

Type Parameters
Type Parameter
T
Parameters
ParameterType
object{ [key: string | number | symbol]: T; }
Returns

ExtMap<T>

flatten()

ts
static flatten<T>(collections): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:76

Flattens an array of ExtMaps into a single ExtMap Last collection's values take precedence for duplicate keys

Type Parameters
Type Parameter
T
Parameters
ParameterType
collectionsExtMap<T>[]
Returns

ExtMap<T>

groupBy()

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

Defined in: site/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
itemsIterable<T>An iterable.
keySelector(item, index) => KA callback which will be invoked for each item in items.
Returns

Map<K, T[]>

Inherited from
ts
Map.groupBy

getOrFail()

ts
getOrFail(key): T;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:88

Parameters
ParameterType
keystring
Returns

T

filter()

ts
filter(predicate): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:101

Returns a new ExtMap with filtered entries

Parameters
ParameterType
predicate(value, key) => boolean
Returns

ExtMap<T>

map()

ts
map<U>(mapper): ExtMap<U>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:114

Returns a new ExtMap with mapped values

Type Parameters
Type Parameter
U
Parameters
ParameterType
mapper(value, key) => U
Returns

ExtMap<U>

sort()

ts
sort(comparator): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:127

Returns a new ExtMap with entries sorted by the given comparator

Parameters
ParameterTypeDescription
comparator(a, b) => numberFunction to determine the sort order
Returns

ExtMap<T>

A new ExtMap with sorted entries

slice()

ts
slice(start, end?): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:146

Returns a new ExtMap containing a subset of entries from the original Map

Parameters
ParameterTypeDescription
startnumberThe starting index (inclusive)
end?numberThe ending index (exclusive)
Returns

ExtMap<T>

A new ExtMap with the sliced entries

toObject()

ts
toObject(): Record<PropertyKey, T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:161

Converts the collection to a plain object

Returns

Record<PropertyKey, T>

toArray()

ts
toArray(): T[];

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:168

Converts the collection to an array of values

Returns

T[]

toSet()

ts
toSet<U>(callback?): Set<U>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:177

Converts the collection to a Set

Type Parameters
Type ParameterDefault type
UPropertyKey
Parameters
ParameterTypeDescription
callback?(key, value) => UOptional function to transform keys before adding to Set
Returns

Set<U>

A Set containing either the keys or transformed values

clear()

ts
clear(): void;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:20

Returns

void

Inherited from
ts
Map.clear

delete()

ts
delete(key): boolean;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:24

Parameters
ParameterType
keyPropertyKey
Returns

boolean

true if an element in the Map existed and has been removed, or false if the element does not exist.

Inherited from
ts
Map.delete

forEach()

ts
forEach(callbackfn, thisArg?): void;

Defined in: site/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
ts
Map.forEach

get()

ts
get(key): T | undefined;

Defined in: site/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
keyPropertyKey
Returns

T | undefined

Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

Inherited from
ts
Map.get

has()

ts
has(key): boolean;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:37

Parameters
ParameterType
keyPropertyKey
Returns

boolean

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

Inherited from
ts
Map.has

set()

ts
set(key, value): this;

Defined in: site/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
keyPropertyKey
valueT
Returns

this

Inherited from
ts
Map.set

entries()

ts
entries(): MapIterator<[PropertyKey, T]>;

Defined in: site/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<[PropertyKey, T]>

Inherited from
ts
Map.entries

keys()

ts
keys(): MapIterator<PropertyKey>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153

Returns an iterable of keys in the map

Returns

MapIterator<PropertyKey>

Inherited from
ts
Map.keys

values()

ts
values(): MapIterator<T>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158

Returns an iterable of values in the map

Returns

MapIterator<T>

Inherited from
ts
Map.values

[iterator]()

ts
iterator: MapIterator<[PropertyKey, T]>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143

Returns an iterable of entries in the map.

Returns

MapIterator<[PropertyKey, T]>

Inherited from
ts
Map.[iterator]

Properties

PropertyModifierTypeInherited fromDefined in
[species]readonlyMapConstructorMap.[species]site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319
sizereadonlynumberMap.sizesite/node_modules/typescript/lib/lib.es2015.collection.d.ts:45
[toStringTag]readonlystringMap.[toStringTag]site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137

sortTransactionsByDependencies()

ts
function sortTransactionsByDependencies(transactions): Transaction[];

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:9

Sort transactions by the order in which they should be broadcast.

Parameters

ParameterType
transactionsTransaction[]

Returns

Transaction[]