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

Method set

packages/effect/src/unstable/reactivity/AtomRef.ts:274–286  ·  view source on GitHub ↗
(value: A[K])

Source from the content-addressed store, hash-verified

272 return new PropRefImpl(this, prop)
273 }
274 set(value: A[K]): AtomRef<A[K]> {
275 if (Array.isArray(this.parent.value)) {
276 const newArray = this.parent.value.slice()
277 newArray[this._prop as number] = value
278 this.parent.set(newArray as A)
279 } else {
280 this.parent.set({
281 ...this.parent.value,
282 [this._prop]: value
283 })
284 }
285 return this
286 }
287 update(f: (value: A[K]) => A[K]): AtomRef<A[K]> {
288 if (Array.isArray(this.parent.value)) {
289 const newArray = this.parent.value.slice()

Callers

nothing calls this directly

Calls 1

setMethod · 0.65

Tested by

no test coverage detected