loudo-ds-map-interfaces 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -28,3 +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 putAll<K extends {}, V extends {}>(map: MapChange<K, V>, input: MapInput<K, V>): void;
|
package/dist/index.js
CHANGED
@@ -15,30 +15,33 @@ export class BaseMap {
|
|
15
15
|
mixin(BaseMap, [Tin]);
|
16
16
|
export class MapChange {
|
17
17
|
putAll(input) {
|
18
|
-
|
19
|
-
for (const x of input) {
|
20
|
-
this.put(x[0], x[1]);
|
21
|
-
}
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
if (Symbol.iterator in input) {
|
25
|
-
for (const x of input) {
|
26
|
-
if (Array.isArray(x)) {
|
27
|
-
this.put(x[0], x[1]);
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
this.put(x.key, x.value);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
return;
|
34
|
-
}
|
35
|
-
for (const k in input) {
|
36
|
-
this.put(k, input[k]);
|
37
|
-
}
|
18
|
+
putAll(this, input);
|
38
19
|
}
|
39
20
|
}
|
40
21
|
mixin(MapChange, [BaseMap, Loud]);
|
41
22
|
export class MapRemove {
|
42
23
|
}
|
43
24
|
mixin(MapRemove, [BaseMap, Loud]);
|
25
|
+
export function putAll(map, input) {
|
26
|
+
if (input instanceof Map) {
|
27
|
+
for (const x of input) {
|
28
|
+
map.put(x[0], x[1]);
|
29
|
+
}
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (Symbol.iterator in input) {
|
33
|
+
for (const x of input) {
|
34
|
+
if (Array.isArray(x)) {
|
35
|
+
map.put(x[0], x[1]);
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
map.put(x.key, x.value);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
for (const k in input) {
|
44
|
+
map.put(k, input[k]);
|
45
|
+
}
|
46
|
+
}
|
44
47
|
//# sourceMappingURL=index.js.map
|