MCPcopy Create free account
hub / github.com/arktypeio/arktype / serializeUnit

Function serializeUnit

ark/schema/roots/unit.ts:58–69  ·  view source on GitHub ↗
(unit: unknown)

Source from the content-addressed store, hash-verified

56 unit === "" ? "empty" : printUnit(unit)
57
58const serializeUnit = (unit: unknown): JsonPrimitive => {
59 const time = dateTimeOf(unit)
60 return (
61 time !== undefined ?
62 Number.isNaN(time) ?
63 "Invalid Date"
64 : (unit as Date).toISOString()
65 : hasDomain(unit, "object") || typeof unit === "symbol" ?
66 registeredReference(unit)
67 : (defaultValueSerializer(unit) as JsonPrimitive)
68 )
69}
70
71const implementation: nodeImplementationOf<Unit.Declaration> =
72 implementNode<Unit.Declaration>({

Callers 1

UnitNodeClass · 0.85

Calls 4

hasDomainFunction · 0.90
registeredReferenceFunction · 0.90
defaultValueSerializerFunction · 0.90
dateTimeOfFunction · 0.85

Tested by

no test coverage detected