MCPcopy Create free account
hub / github.com/Effect-TS/effect / compileGet

Function compileGet

packages/effect/src/Optic.ts:1199–1215  ·  view source on GitHub ↗
(nodes: Node, kind: Kind)

Source from the content-addressed store, hash-verified

1197}
1198
1199function compileGet(nodes: Node, kind: Kind): (s: any) => any {
1200 return (s) => {
1201 for (let i = 0; i < nodes.length; i++) {
1202 const op = nodes[i]
1203 const result = op.get(s)
1204 if (hasFailingGet(op.kind)) {
1205 if (Result.isFailure(result)) {
1206 return result
1207 }
1208 s = result.success
1209 } else {
1210 s = result
1211 }
1212 }
1213 return hasFailingGet(kind) ? Result.succeed(s) : s
1214 }
1215}
1216
1217function compileSet(nodes: Node, kind: Kind): (a: any, s: any) => any {
1218 if (hasSourceFreeSet(kind)) {

Callers 1

makeFunction · 0.85

Calls 3

hasFailingGetFunction · 0.85
getMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected