@tmlmobilidade/utils 20260607.1410.59 → 20260608.1007.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/maps/index.d.ts +1 -0
- package/dist/maps/index.js +1 -0
- package/dist/maps/push-array-to-map.d.ts +12 -0
- package/dist/maps/push-array-to-map.js +19 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './caching/index.js';
|
|
|
3
3
|
export * from './generic/index.js';
|
|
4
4
|
export * from './get-public-trip-id.js';
|
|
5
5
|
export * from './http/index.js';
|
|
6
|
+
export * from './maps/index.js';
|
|
6
7
|
export * from './numbers/index.js';
|
|
7
8
|
export * from './objects/index.js';
|
|
8
9
|
export * from './permissions.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './caching/index.js';
|
|
|
3
3
|
export * from './generic/index.js';
|
|
4
4
|
export * from './get-public-trip-id.js';
|
|
5
5
|
export * from './http/index.js';
|
|
6
|
+
export * from './maps/index.js';
|
|
6
7
|
export * from './numbers/index.js';
|
|
7
8
|
export * from './objects/index.js';
|
|
8
9
|
export * from './permissions.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './push-array-to-map.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './push-array-to-map.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pushes a value into an array stored at the specified key in a Map.
|
|
3
|
+
* - If the key does not exist in the map, initializes the value as a new array.
|
|
4
|
+
* - Otherwise, appends the value to the existing array.
|
|
5
|
+
*
|
|
6
|
+
* @template K - The type of map keys.
|
|
7
|
+
* @template V - The type of array values.
|
|
8
|
+
* @param {Map<K, V[]>} map - The map that stores arrays as values.
|
|
9
|
+
* @param {K} key - The key whose array will receive the new value.
|
|
10
|
+
* @param {V} value - The value to push into the array at the specified key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pushArrayToMap<K, V>(map: Map<K, V[]>, key: K, value: V): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pushes a value into an array stored at the specified key in a Map.
|
|
3
|
+
* - If the key does not exist in the map, initializes the value as a new array.
|
|
4
|
+
* - Otherwise, appends the value to the existing array.
|
|
5
|
+
*
|
|
6
|
+
* @template K - The type of map keys.
|
|
7
|
+
* @template V - The type of array values.
|
|
8
|
+
* @param {Map<K, V[]>} map - The map that stores arrays as values.
|
|
9
|
+
* @param {K} key - The key whose array will receive the new value.
|
|
10
|
+
* @param {V} value - The value to push into the array at the specified key.
|
|
11
|
+
*/
|
|
12
|
+
export function pushArrayToMap(map, key, value) {
|
|
13
|
+
let arr = map.get(key);
|
|
14
|
+
if (!arr) {
|
|
15
|
+
arr = [];
|
|
16
|
+
map.set(key, arr);
|
|
17
|
+
}
|
|
18
|
+
arr.push(value);
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20260608.1007.26",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@tmlmobilidade/tsconfig": "*",
|
|
50
|
-
"@types/node": "25.9.
|
|
50
|
+
"@types/node": "25.9.2",
|
|
51
51
|
"resolve-tspaths": "0.8.23",
|
|
52
52
|
"tsc-watch": "7.2.0",
|
|
53
53
|
"typescript": "6.0.3"
|