(key: PropertyKey)
| 1058 | } |
| 1059 | } |
| 1060 | ) |
| 1061 | ) |
| 1062 | ) |
| 1063 | } |
| 1064 | pick(keys: any) { |
| 1065 | return this.compose(makeLens(Struct.pick(keys), (p, a) => ({ ...Struct.omit(a, keys), ...p }))) |
| 1066 | } |
| 1067 | omit(keys: any) { |
| 1068 | return this.compose(makeLens(Struct.omit(keys), (o, a) => ({ ...Struct.pick(a, keys), ...o }))) |
| 1069 | } |
| 1070 | notUndefined(): any { |
| 1071 | return this.refine(Predicate.isNotUndefined, { expected: "a value other than `undefined`" }) |
| 1072 | } |
| 1073 | forEach<S, A, B>(this: Traversal<S, A>, f: (iso: Iso<A, A>) => Optional<A, B>): Traversal<S, B> { |
| 1074 | const inner = f(id<A>()) |
| 1075 | return makeOptional<S, ReadonlyArray<B>>( |
| 1076 | // GET: collect focused Bs |
| 1077 | (s) => |
| 1078 | Result.map(this.getResult(s), (as) => { |
| 1079 | const bs: Array<B> = [] |
| 1080 | for (let i = 0; i < as.length; i++) { |
| 1081 | const r = inner.getResult(as[i]) |
| 1082 | if (Result.isSuccess(r)) bs.push(r.success) |
| 1083 | } |
| 1084 | return bs |
| 1085 | }), |
nothing calls this directly
no test coverage detected