gofront 1.9.1 → 1.9.2

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/README.md CHANGED
@@ -461,7 +461,7 @@ For detailed command flags, project configuration (`gofront.json`), multi-file p
461
461
  ## Tests
462
462
 
463
463
  ```sh
464
- npm test # unit, zero-alloc perf, and example tests (~4,700 tests, no browser required)
464
+ npm test # unit, zero-alloc perf, and example tests (~4,800 tests, no browser required)
465
465
  npm run test:e2e # E2E browser tests (Playwright, headless Chromium)
466
466
  npm run bench # Raycast, JSON, and SIMD particle benchmarks (pure JS vs hybrid WASM)
467
467
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gofront",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "author": "Luuk van Venrooij",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node scripts/build-examples.js",
39
- "test": "node test/unit/run.js && node test/perf/zero-alloc.js && node test/perf/bce-mathx.js && node src/index.js test --dom example/...",
39
+ "test": "node test/unit/run.js && node test/perf/zero-alloc.js && node test/perf/bce-mathx.js && node test/perf/bundle-size.js && node test/perf/bundle-size.js --self-test && node src/index.js test --dom example/...",
40
40
  "test:e2e": "playwright test",
41
41
  "test:coverage": "c8 --include='src/**' --reporter=text --reporter=lcov node test/unit/run.js",
42
42
  "bench": "node --expose-gc test/perf/raycast-bench.js && node test/perf/json-bench.js && node test/perf/fmt-bench.js && node --expose-gc test/perf/particle-bench.js",
@@ -196,26 +196,40 @@ function _scanTemplateLiteral(code, i, len) {
196
196
  return j;
197
197
  }
198
198
 
199
+ // Consume digits matching `digit` plus `_` numeric separators.
200
+ function _scanDigits(code, j, len, digit) {
201
+ while (j < len && (digit.test(code[j]) || code[j] === "_")) j++;
202
+ return j;
203
+ }
204
+
199
205
  function _scanDecimalNumber(code, j, len) {
200
- while (j < len && /[0-9]/.test(code[j])) j++;
206
+ const digit = /[0-9]/;
207
+ j = _scanDigits(code, j, len, digit);
201
208
  if (j < len && code[j] === ".") {
202
209
  j++;
203
- while (j < len && /[0-9]/.test(code[j])) j++;
210
+ j = _scanDigits(code, j, len, digit);
204
211
  }
205
212
  if (j < len && (code[j] === "e" || code[j] === "E")) {
206
213
  j++;
207
214
  if (j < len && (code[j] === "+" || code[j] === "-")) j++;
208
- while (j < len && /[0-9]/.test(code[j])) j++;
215
+ j = _scanDigits(code, j, len, digit);
209
216
  }
210
217
  return j;
211
218
  }
212
219
 
220
+ const RADIX_DIGITS = {
221
+ x: /[0-9a-fA-F]/,
222
+ b: /[01]/,
223
+ o: /[0-7]/,
224
+ };
225
+
213
226
  function _scanNumber(code, i, len) {
214
227
  const ch = code[i];
215
228
  let j = i + 1;
216
- if (ch === "0" && j < len && (code[j] === "x" || code[j] === "X")) {
217
- j++;
218
- while (j < len && /[0-9a-fA-F]/.test(code[j])) j++;
229
+ const radix =
230
+ ch === "0" && j < len ? RADIX_DIGITS[code[j].toLowerCase()] : null;
231
+ if (radix) {
232
+ j = _scanDigits(code, j + 1, len, radix);
219
233
  } else {
220
234
  j = _scanDecimalNumber(code, j, len);
221
235
  }