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
new ExtMap<T>(entries?): ExtMap<T>;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:50
Parameters
| Parameter | Type |
|---|---|
entries? | readonly readonly [PropertyKey, T][] | null |
Returns
ExtMap<T>
Inherited from
Map<PropertyKey, T>.constructorConstructor
new ExtMap<T>(iterable?): ExtMap<T>;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:49
Parameters
| Parameter | Type |
|---|---|
iterable? | Iterable<readonly [PropertyKey, T], any, any> | null |
Returns
ExtMap<T>
Inherited from
Map<PropertyKey, T>.constructorMethods
fromArray()
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
| Parameter | Type |
|---|---|
array | readonly T[] |
keySelector | (item) => K |
Returns
ExtMap<T>
fromObject()
static fromObject<T>(object): ExtMap<T>;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:64
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
object | { [key: string | number | symbol]: T; } |
Returns
ExtMap<T>
flatten()
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
| Parameter | Type |
|---|---|
collections | ExtMap<T>[] |
Returns
ExtMap<T>
groupBy()
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
| Parameter | Type | Description |
|---|---|---|
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.groupBygetOrFail()
getOrFail(key): T;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:88
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
T
filter()
filter(predicate): ExtMap<T>;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:101
Returns a new ExtMap with filtered entries
Parameters
| Parameter | Type |
|---|---|
predicate | (value, key) => boolean |
Returns
ExtMap<T>
map()
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
| Parameter | Type |
|---|---|
mapper | (value, key) => U |
Returns
ExtMap<U>
sort()
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
| Parameter | Type | Description |
|---|---|---|
comparator | (a, b) => number | Function to determine the sort order |
Returns
ExtMap<T>
A new ExtMap with sorted entries
slice()
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
| Parameter | Type | Description |
|---|---|---|
start | number | The starting index (inclusive) |
end? | number | The ending index (exclusive) |
Returns
ExtMap<T>
A new ExtMap with the sliced entries
toObject()
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()
toArray(): T[];Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:168
Converts the collection to an array of values
Returns
T[]
toSet()
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 Parameter | Default type |
|---|---|
U | PropertyKey |
Parameters
| Parameter | Type | Description |
|---|---|---|
callback? | (key, value) => U | Optional function to transform keys before adding to Set |
Returns
Set<U>
A Set containing either the keys or transformed values
clear()
clear(): void;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
Returns
void
Inherited from
Map.cleardelete()
delete(key): boolean;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
Parameters
| Parameter | Type |
|---|---|
key | PropertyKey |
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.deleteforEach()
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
| Parameter | Type |
|---|---|
callbackfn | (value, key, map) => void |
thisArg? | any |
Returns
void
Inherited from
Map.forEachget()
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
| Parameter | Type |
|---|---|
key | PropertyKey |
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
Map.gethas()
has(key): boolean;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
Parameters
| Parameter | Type |
|---|---|
key | PropertyKey |
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Map.hasset()
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
| Parameter | Type |
|---|---|
key | PropertyKey |
value | T |
Returns
this
Inherited from
Map.setentries()
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
Map.entrieskeys()
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
Map.keysvalues()
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
Map.values[iterator]()
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
Map.[iterator]Properties
sortTransactionsByDependencies()
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
| Parameter | Type |
|---|---|
transactions | Transaction[] |