s2cfgtojson 2.1.0 → 2.1.1
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 +4 -4
- package/package.json +1 -1
package/Struct.mts
CHANGED
|
@@ -229,10 +229,10 @@ export abstract class Struct<T extends Entries = {}> {
|
|
|
229
229
|
let value: string | number = match[3].trim();
|
|
230
230
|
try {
|
|
231
231
|
// understand 0.1f / 1. / 0.f / .1 / .1f -> ((\d*)\.?(\d+)|(\d+)\.?(\d*))f?
|
|
232
|
-
const matches = value.match(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
const matches = value.match(/^(\d*)\.?(\d*)f?$/);
|
|
233
|
+
const first = matches[1];
|
|
234
|
+
const second = matches[2];
|
|
235
|
+
if (first || second) {
|
|
236
236
|
value = parseFloat(`${first || 0}${second ? `.${second}` : ""}`);
|
|
237
237
|
} else {
|
|
238
238
|
value = JSON.parse(value);
|