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.
Files changed (2) hide show
  1. package/Struct.mts +4 -4
  2. 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(/(\d*)\.?(\d*)f?/);
233
- if (matches) {
234
- const first = matches[1];
235
- const second = matches[2];
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s2cfgtojson",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Converts Stalker 2 Cfg file into a POJO",
5
5
  "keywords": [
6
6
  "stalker",