|
| 1 | +# BUILD PR — Promote `asNumber(value, fallback = 0)` into shared math |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Move the duplicate `asNumber` helper into the canonical numeric home and migrate the exact duplicate sites. |
| 5 | + |
| 6 | +## Exact Target Files |
| 7 | +- `src/shared/math/numberNormalization.js` |
| 8 | +- `src/shared/utils/networkDebugUtils.js` |
| 9 | +- `src/engine/debug/network/shared/networkDebugUtils.js` |
| 10 | + |
| 11 | +## Required Code Changes |
| 12 | +1. In `src/shared/math/numberNormalization.js` |
| 13 | + - add/export `asNumber(value, fallback = 0)` |
| 14 | + - preserve current runtime behavior of the duplicate helper exactly |
| 15 | + |
| 16 | +2. In `src/shared/utils/networkDebugUtils.js` |
| 17 | + - stop defining local `asNumber` |
| 18 | + - import `asNumber` from `src/shared/math/numberNormalization.js` |
| 19 | + - preserve the file's existing public API |
| 20 | + |
| 21 | +3. In `src/engine/debug/network/shared/networkDebugUtils.js` |
| 22 | + - stop defining local `asNumber` |
| 23 | + - import `asNumber` from `src/shared/math/numberNormalization.js` |
| 24 | + - preserve the file's existing public API |
| 25 | + |
| 26 | +## Hard Constraints |
| 27 | +- exact files only |
| 28 | +- do not touch `asObject`, `asArray`, or any other helper in this PR |
| 29 | +- do not modify any consumer files outside the exact list |
| 30 | +- do not rename exports other than replacing local helper definitions with shared import usage |
| 31 | +- do not refactor unrelated logic |
| 32 | + |
| 33 | +## Acceptance Criteria |
| 34 | +- one canonical `asNumber` implementation exists in `src/shared/math/numberNormalization.js` |
| 35 | +- both network debug utility files use the shared math implementation |
| 36 | +- no local `asNumber` implementation remains in the two target files |
| 37 | +- no import/export breakage |
0 commit comments