Consolidate server utilities into shared module

- Add lib/server/utils/normalize.ts with normalizeTicker, normalizeTagsOrNull, nowIso, todayIso
- Add lib/server/utils/validation.ts with asRecord, asBoolean, asStringArray, asEnum
- Add lib/server/utils/index.ts re-exporting all utilities
- Remove duplicate lib/server/utils.ts (old file)
- Update all repos and files to use shared utilities
- Remove redundant ?? '' from normalizeTicker calls
- Update watchlist.ts to use normalizeTagsOrNull for null-return tags
This commit is contained in:
2026-03-15 15:56:16 -04:00
parent edf1cfb421
commit 5f0abbb007
14 changed files with 193 additions and 127 deletions

20
lib/server/utils/index.ts Normal file
View File

@@ -0,0 +1,20 @@
export {
normalizeTicker,
normalizeTickerOrNull,
normalizeTags,
normalizeTagsOrNull,
normalizeOptionalString,
normalizeRecord,
normalizePositiveInteger,
nowIso,
todayIso
} from './normalize';
export {
asRecord,
asOptionalRecord,
asPositiveNumber,
asBoolean,
asStringArray,
asEnum
} from './validation';