Refactor lookup and normalization functions to improve type safety and error handling. Updated domain lookup to provide a stable ISO string fallback and enhanced error messaging. Modified RDAP normalization to use stricter types and added utility functions for type assertions.

This commit is contained in:
2025-09-24 14:56:56 -04:00
parent 38cf9c5eaa
commit a788b0147a
6 changed files with 154 additions and 74 deletions
+2
View File
@@ -7,9 +7,11 @@ test("toISO parses ISO and common whois formats", () => {
assert.equal(iso, "2023-01-02T03:04:05Z");
const noZ = toISO("2023-01-02 03:04:05");
// biome-ignore lint/style/noNonNullAssertion: this is fine
assert.match(noZ!, /^2023-01-02T03:04:05Z$/);
const slash = toISO("2023/01/02 03:04:05");
// biome-ignore lint/style/noNonNullAssertion: this is fine
assert.match(slash!, /^2023-01-02T03:04:05Z$/);
const dmy = toISO("02-Jan-2023");