s2cfgtojson 3.2.3 → 3.2.4
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 +10 -9
- package/Struct.test.mts +1 -3
- package/package.json +1 -1
package/Struct.mts
CHANGED
|
@@ -21,7 +21,7 @@ const INTERNAL_PROPS = new Set([
|
|
|
21
21
|
"filter",
|
|
22
22
|
"map",
|
|
23
23
|
"toString",
|
|
24
|
-
]);
|
|
24
|
+
] satisfies Array<keyof Struct>);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* This file is part of the Stalker 2 Modding Tools project.
|
|
@@ -94,11 +94,13 @@ export class Struct {
|
|
|
94
94
|
return Struct.fromString(this.toString())[0] as this;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
entries
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
entries<
|
|
98
|
+
K extends Exclude<keyof this, Internal>,
|
|
99
|
+
V extends (typeof this)[K],
|
|
100
|
+
>() {
|
|
101
|
+
return Object.entries(this).filter(
|
|
102
|
+
([key]) => !INTERNAL_PROPS.has(key as any),
|
|
103
|
+
) as [K, V][];
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
forEach<K extends Exclude<keyof this, Internal>, V extends (typeof this)[K]>(
|
|
@@ -156,8 +158,7 @@ export class Struct {
|
|
|
156
158
|
|
|
157
159
|
text += "\n";
|
|
158
160
|
// Add all keys
|
|
159
|
-
text +=
|
|
160
|
-
.filter(([key]) => !INTERNAL_PROPS.has(key))
|
|
161
|
+
text += this.entries()
|
|
161
162
|
.map(([key, value]) => {
|
|
162
163
|
const nameAlreadyRendered =
|
|
163
164
|
value instanceof Struct && value.__internal__.rawName;
|
|
@@ -167,7 +168,7 @@ export class Struct {
|
|
|
167
168
|
let equalsOrColon = "";
|
|
168
169
|
let spaceOrNoSpace = "";
|
|
169
170
|
if (!nameAlreadyRendered) {
|
|
170
|
-
keyOrIndex = renderKeyName(key, useAsterisk) + " ";
|
|
171
|
+
keyOrIndex = renderKeyName(key as string, useAsterisk) + " ";
|
|
171
172
|
equalsOrColon = value instanceof Struct ? ":" : "=";
|
|
172
173
|
spaceOrNoSpace = value === "" ? "" : " ";
|
|
173
174
|
}
|
package/Struct.test.mts
CHANGED
|
@@ -318,6 +318,4 @@ struct.end`;
|
|
|
318
318
|
// noinspection JSUnusedLocalSymbols
|
|
319
319
|
const MyRank: ERank = "ERank::Experienced, ERank::Veteran, ERank::Master";
|
|
320
320
|
// noinspection BadExpressionStatementJS
|
|
321
|
-
(
|
|
322
|
-
e.Cost *= 2;
|
|
323
|
-
});
|
|
321
|
+
({}) as ArmorPrototype["MeshGenerator"];
|