(key: PropertyKey, ..._rest: Array<any>)
| 1035 | ) |
| 1036 | } |
| 1037 | at(key: PropertyKey, ..._rest: Array<any>): any { |
| 1038 | const err = Result.fail( |
| 1039 | new SchemaIssue.Pointer([key], new SchemaIssue.MissingKey(undefined)) |
| 1040 | ) |
| 1041 | return make( |
| 1042 | compose( |
| 1043 | this.node, |
| 1044 | primitiveNode( |
| 1045 | "Optional", |
| 1046 | (s) => Object.hasOwn(s, key) ? Result.succeed(s[key]) : err, |
| 1047 | (a, s) => { |
| 1048 | if (Object.hasOwn(s, key)) { |
| 1049 | const copy = cloneShallow(s) |
| 1050 | InternalRecord.assignProperty(copy, key, a) |
| 1051 | return Result.succeed(copy) |
| 1052 | } else { |
| 1053 | return err |
| 1054 | } |
| 1055 | } |
| 1056 | ) |
| 1057 | ) |
| 1058 | ) |
| 1059 | } |
| 1060 | pick(keys: any) { |
| 1061 | return this.compose(makeLens(Struct.pick(keys), (p, a) => ({ ...a, ...p }))) |
| 1062 | } |
nothing calls this directly
no test coverage detected