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

Method constructor

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

Source from the content-addressed store, hash-verified

353 readonly set: (a: any, s?: any) => any
354
355 constructor(path: ReadonlyArray<PropertyKey>) {
356 this.path = path
357 this.get = (s) => {
358 let out = s
359 for (let i = 0; i < path.length; i++) {
360 out = out[path[i]]
361 }
362 return out
363 }
364 this.set = (a, s) => {
365 const out = cloneShallow(s)
366 let current = out
367 let i = 0
368 for (; i < path.length - 1; i++) {
369 const key = path[i]
370 InternalRecord.assignProperty(current, key, cloneShallow(current[key]))
371 current = current[key]
372 }
373 InternalRecord.assignProperty(current, path[i], a)
374 return out
375 }
376 }
377}
378
379class CheckNode<T> {

Callers

nothing calls this directly

Calls 1

cloneShallowFunction · 0.85

Tested by

no test coverage detected