s2cfgtojson 3.2.7 → 3.2.9
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/Struct.mts +8 -1
- package/package.json +1 -1
package/Struct.mts
CHANGED
|
@@ -94,7 +94,11 @@ export class Struct {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
clone() {
|
|
97
|
-
|
|
97
|
+
const isRoot = this.__internal__.isRoot;
|
|
98
|
+
this.__internal__.isRoot = true;
|
|
99
|
+
const newInstance = Struct.fromString(this.toString())[0] as this;
|
|
100
|
+
this.__internal__.isRoot = isRoot;
|
|
101
|
+
return newInstance;
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
entries<
|
|
@@ -140,6 +144,9 @@ export class Struct {
|
|
|
140
144
|
const clone = this.clone();
|
|
141
145
|
clone.entries().forEach(([key, value], i, arr) => {
|
|
142
146
|
clone[key] = callback([key as K, value as V], i, arr as any);
|
|
147
|
+
if (clone[key] === null || clone[key] === undefined) {
|
|
148
|
+
delete clone[key];
|
|
149
|
+
}
|
|
143
150
|
});
|
|
144
151
|
return clone;
|
|
145
152
|
}
|