(key: PropertyKey)
| 992 | return make(compose(this.node, [new PathNode([key])])) |
| 993 | } |
| 994 | optionalKey(key: PropertyKey): any { |
| 995 | return make( |
| 996 | compose( |
| 997 | this.node, |
| 998 | primitiveNode( |
| 999 | "Lens", |
| 1000 | (s) => s[key], |
| 1001 | (a, s) => { |
| 1002 | const copy = cloneShallow(s) |
| 1003 | if (a === undefined) { |
| 1004 | if (Array.isArray(copy) && typeof key === "number") { |
| 1005 | copy.splice(key, 1) |
| 1006 | } else { |
| 1007 | delete copy[key] |
| 1008 | } |
| 1009 | } else { |
| 1010 | InternalRecord.assignProperty(copy, key, a) |
| 1011 | } |
| 1012 | return copy |
| 1013 | } |
| 1014 | ) |
| 1015 | ) |
| 1016 | ) |
| 1017 | } |
| 1018 | check(...checks: readonly [SchemaAST.Check<any>, ...Array<SchemaAST.Check<any>>]): any { |
| 1019 | return make(compose(this.node, [new CheckNode(checks)])) |
| 1020 | } |
nothing calls this directly
no test coverage detected