loudo-ds-map-interfaces 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/package.json +1 -1
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
|