(u: unknown, preserveEmptyStrings: boolean)
| 810 | } |
| 811 | |
| 812 | function 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 | |
| 826 | function stringNode(value: string, preserveEmptyStrings: boolean): Node | undefined { |
| 827 | const normalized = emptyStringAsMissing(value, preserveEmptyStrings) |
no test coverage detected