loudo-ds-map-interfaces 0.0.8 → 0.0.12
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 -1
- package/dist/index.js +8 -8
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -28,4 +28,4 @@ export interface MapRemove<K extends {}, V extends {}> extends BaseMap<K, V>, Lo
|
|
28
28
|
}
|
29
29
|
export type Object<K extends {}, V extends {}> = K extends string ? Record<string, V> : never;
|
30
30
|
export type MapInput<K extends {}, V extends {}> = Map<K, V> | Iterable<Entry<K, V> | [K, V]> | Object<K, V>;
|
31
|
-
export declare function
|
31
|
+
export declare function forEach<K extends {}, V extends {}>(input: MapInput<K, V>, f: (k: K, v: V) => void): void;
|
package/dist/index.js
CHANGED
@@ -15,33 +15,33 @@ export class BaseMap {
|
|
15
15
|
mixin(BaseMap, [Tin]);
|
16
16
|
export class MapChange {
|
17
17
|
putAll(input) {
|
18
|
-
|
18
|
+
const me = this;
|
19
|
+
forEach(input, (k, v) => me.put(k, v));
|
19
20
|
}
|
20
21
|
}
|
21
22
|
mixin(MapChange, [BaseMap, Loud]);
|
22
23
|
export class MapRemove {
|
23
24
|
}
|
24
25
|
mixin(MapRemove, [BaseMap, Loud]);
|
25
|
-
export function
|
26
|
+
export function forEach(input, f) {
|
26
27
|
if (input instanceof Map) {
|
27
28
|
for (const x of input) {
|
28
|
-
|
29
|
+
f(x[0], x[1]);
|
29
30
|
}
|
30
31
|
return;
|
31
32
|
}
|
32
33
|
if (Symbol.iterator in input) {
|
33
34
|
for (const x of input) {
|
34
35
|
if (Array.isArray(x)) {
|
35
|
-
|
36
|
+
f(x[0], x[1]);
|
36
37
|
}
|
37
38
|
else {
|
38
|
-
|
39
|
+
f(x.key, x.value);
|
39
40
|
}
|
40
41
|
}
|
41
42
|
return;
|
42
43
|
}
|
43
|
-
for (const k
|
44
|
-
|
45
|
-
}
|
44
|
+
for (const [k, v] of Object.entries(input))
|
45
|
+
f(k, v);
|
46
46
|
}
|
47
47
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "loudo-ds-map-interfaces",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.12",
|
5
5
|
"description": "Core interfaces for loud maps (dictionaries.)",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"types": "dist/index.d.ts",
|
@@ -31,6 +31,6 @@
|
|
31
31
|
"vitest": "^1.2.2"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"loudo-ds-core": "^0.0.
|
34
|
+
"loudo-ds-core": "^0.0.26"
|
35
35
|
}
|
36
36
|
}
|