(u: unknown, preserveEmptyStrings: boolean)
| 828 | } |
| 829 | |
| 830 | function describeUnknown(u: unknown, preserveEmptyStrings: boolean): Node | undefined { |
| 831 | if (u === undefined || u === null) return undefined |
| 832 | if (typeof u === "string") return stringNode(u, preserveEmptyStrings) |
| 833 | if (typeof u === "number" || typeof u === "boolean" || typeof u === "bigint") { |
| 834 | return makeValue(String(u)) |
| 835 | } |
| 836 | if (Array.isArray(u)) return makeArray(u.length) |
| 837 | if (Predicate.isObject(u)) { |
| 838 | return makeRecord(new Set(Object.keys(u))) |
| 839 | } |
| 840 | // unknown values |
| 841 | return makeValue(format(u)) |
| 842 | } |
| 843 | |
| 844 | function stringNode(value: string, preserveEmptyStrings: boolean): Node | undefined { |
| 845 | const normalized = emptyStringAsMissing(value, preserveEmptyStrings) |
no test coverage detected