s2cfgtojson 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/Struct.mts +5 -2
  2. package/package.json +1 -1
package/Struct.mts CHANGED
@@ -163,7 +163,7 @@ export abstract class Struct<T extends Entries = {}> {
163
163
  Struct.parseStructName(match[1].trim()) || `UnnamedStruct${index}`;
164
164
 
165
165
  const dummy = new (Struct.createDynamicClass(name))();
166
- dummy._id = match[1];
166
+ dummy._id = match[1].trim();
167
167
  if (match[3]) {
168
168
  const refs = match[3]
169
169
  .split(";")
@@ -190,7 +190,10 @@ export abstract class Struct<T extends Entries = {}> {
190
190
  throw new Error(`Invalid key-value pair: ${line}`);
191
191
  }
192
192
  const key = match[1].trim();
193
- const value = match[3].trim();
193
+ let value: string | number = match[3].trim();
194
+ try {
195
+ value = JSON.parse(value);
196
+ } catch (e) {}
194
197
  Struct.addEntry(parent, key, value, index);
195
198
  };
196
199
  let index = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s2cfgtojson",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Converts Stalker 2 Cfg file into a POJO",
5
5
  "keywords": [
6
6
  "stalker",