(key: PropertyKey)
| 1004 | return make(compose(this.node, [new PathNode([key])])) |
| 1005 | } |
| 1006 | optionalKey(key: PropertyKey): any { |
| 1007 | return make( |
| 1008 | compose( |
| 1009 | this.node, |
| 1010 | primitiveNode( |
| 1011 | "Lens", |
| 1012 | (s) => s[key], |
| 1013 | (a, s) => { |
| 1014 | const copy = cloneShallow(s) |
| 1015 | if (a === undefined) { |
| 1016 | if ( |
| 1017 | Array.isArray(copy) && |
| 1018 | (typeof key === "number" || (typeof key === "string" && Arr.isCanonicalArrayIndex(key))) |
| 1019 | ) { |
| 1020 | copy.splice(Number(key), 1) |
| 1021 | } else { |
| 1022 | delete copy[key] |
| 1023 | } |
| 1024 | } else { |
| 1025 | InternalRecord.assignProperty(copy, key, a) |
| 1026 | } |
| 1027 | return copy |
| 1028 | } |
| 1029 | ) |
| 1030 | ) |
| 1031 | ) |
| 1032 | } |
| 1033 | check(...checks: readonly [SchemaAST.Check<any>, ...Array<SchemaAST.Check<any>>]): any { |
| 1034 | return make(compose(this.node, [new CheckNode(checks)])) |
| 1035 | } |
nothing calls this directly
no test coverage detected