feat(common): add zero-dep scalar coercion primitives (coerce)
Phase 1 of de-duplicating config normalization. isObject/boolOr/clampNum/ clampInt were copied verbatim across notifications/config and webui/ ui-config; give them a single home as @snowluma/common/coerce (new per-file subpath export, zero deps — fits common's leaf-utility charter). Byte-identical to both originals (adversarially verified), so the phase-2 migration is a pure delete-and-import. clampInt is clamp-then-trunc; 10 table tests pin types, numeric-string coercion, non-finite→fallback, bounds, and the clamp/trunc order. Not yet wired into consumers.
This commit is contained in:
3 files changed
+112
No files matched your search
@@ -16,6 +16,10 @@
|
||||
"types": "./src/logger.ts",
|
||||
"default": "./src/logger.ts"
|
||||
},
|
||||
"./coerce": {
|
||||
"types": "./src/coerce.ts",
|
||||
"default": "./src/coerce.ts"
|
||||
},
|
||||
"./hex": {
|
||||
"types": "./src/hex.ts",
|
||||
"default": "./src/hex.ts"
|
||||
|
||||
Reference in new issue
Block a user