MCPcopy Create free account
hub / github.com/Effect-TS/effect / describeUnknown

Function describeUnknown

packages/effect/src/ConfigProvider.ts:812–824  ·  view source on GitHub ↗
(u: unknown, preserveEmptyStrings: boolean)

Source from the content-addressed store, hash-verified

810}
811
812function describeUnknown(u: unknown, preserveEmptyStrings: boolean): Node | undefined {
813 if (u === undefined || u === null) return undefined
814 if (typeof u === "string") return stringNode(u, preserveEmptyStrings)
815 if (typeof u === "number" || typeof u === "boolean" || typeof u === "bigint") {
816 return makeValue(String(u))
817 }
818 if (Array.isArray(u)) return makeArray(u.length)
819 if (Predicate.isObject(u)) {
820 return makeRecord(new Set(Object.keys(u)))
821 }
822 // unknown values
823 return makeValue(format(u))
824}
825
826function stringNode(value: string, preserveEmptyStrings: boolean): Node | undefined {
827 const normalized = emptyStringAsMissing(value, preserveEmptyStrings)

Callers 1

nodeAtJsonFunction · 0.85

Calls 6

formatFunction · 0.90
stringNodeFunction · 0.85
makeValueFunction · 0.85
makeArrayFunction · 0.85
makeRecordFunction · 0.85
StringInterface · 0.70

Tested by

no test coverage detected