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

Method constructor

packages/effect/src/Optic.ts:346–367  ·  view source on GitHub ↗
(path: ReadonlyArray<PropertyKey>)

Source from the content-addressed store, hash-verified

344 readonly set: (a: any, s?: any) => any
345
346 constructor(path: ReadonlyArray<PropertyKey>) {
347 this.path = path
348 this.get = (s) => {
349 let out = s
350 for (let i = 0; i < path.length; i++) {
351 out = out[path[i]]
352 }
353 return out
354 }
355 this.set = (a, s) => {
356 const out = cloneShallow(s)
357 let current = out
358 let i = 0
359 for (; i < path.length - 1; i++) {
360 const key = path[i]
361 InternalRecord.assignProperty(current, key, cloneShallow(current[key]))
362 current = current[key]
363 }
364 InternalRecord.assignProperty(current, path[i], a)
365 return out
366 }
367 }
368}
369
370class CheckNode<T> {

Callers

nothing calls this directly

Calls 1

cloneShallowFunction · 0.85

Tested by

no test coverage detected