( v: unknown, into: Facts )
| 770 | |
| 771 | // what a prop's value says, if it's one a literal can hold without throwing |
| 772 | const valueFacts = ( |
| 773 | v: unknown, |
| 774 | into: Facts |
| 775 | ): [facts: Facts, held: unknown] | undefined => { |
| 776 | if (typeof v === "string") { |
| 777 | const facts = scanLeaf(v) |
| 778 | return facts && [facts, v] |
| 779 | } |
| 780 | if (Array.isArray(v)) { |
| 781 | const element = v.length === 2 && v[1] === "[]" && valueFacts(v[0], into) |
| 782 | return element && !element[0].defaults ? |
| 783 | [arrayFacts(element[0]), [element[1], "[]"]] |
| 784 | : undefined |
| 785 | } |
| 786 | if (v instanceof RegExp) { |
| 787 | const facts = regexFacts(v) |
| 788 | return facts && [facts, v] |
| 789 | } |
| 790 | if (typeof v !== "object" && typeof v !== "function") return |
| 791 | if (!v) return |
| 792 | const d = deferred.get(v) |
| 793 | if (d) return [d.facts, d.target ?? v] |
| 794 | if (isNode(v)) { |
| 795 | const of = isInstanceOf(v, BaseRoot) && v.isRoot() && nodeFacts(v) |
| 796 | return of ? [of, v] : undefined |
| 797 | } |
| 798 | if (typeof v === "function" || !isPlainObject(v)) return |
| 799 | const nested: Facts = { key: "", domains: objectBits, pure: true } |
| 800 | const held = walkLiteral(v as Dict, nested, into) |
| 801 | return ( |
| 802 | held && [ |
| 803 | { |
| 804 | key: nested.key, |
| 805 | domains: objectBits, |
| 806 | pure: into.pure, |
| 807 | narrowedWithin: nested.narrowedWithin, |
| 808 | unitsWithin: nested.unitsWithin, |
| 809 | ends: nested.ends |
| 810 | }, |
| 811 | held |
| 812 | ] |
| 813 | ) |
| 814 | } |
| 815 | |
| 816 | const walkLiteral = ( |
| 817 | def: Dict, |
no test coverage detected