MCPcopy Index your code
hub / github.com/angular/angular / valueForWrite

Function valueForWrite

packages/forms/signals/src/util/deep_signal.ts:51–59  ·  view source on GitHub ↗

* Gets an updated root value to use when setting a value on a deepSignal with the given path. * @param sourceValue The current value of the deepSignal's source. * @param newPropValue The value being written to the deepSignal's property * @param prop The deepSignal's property key * @returns An up

(sourceValue: unknown, newPropValue: unknown, prop: PropertyKey)

Source from the content-addressed store, hash-verified

49 * @returns An updated value for the deepSignal's source
50 */
51function valueForWrite(sourceValue: unknown, newPropValue: unknown, prop: PropertyKey): unknown {
52 if (isArray(sourceValue)) {
53 const newValue = [...sourceValue];
54 newValue[prop as number] = newPropValue;
55 return newValue;
56 } else {
57 return {...(sourceValue as object), [prop]: newPropValue};
58 }
59}

Callers 1

deepSignalFunction · 0.85

Calls 1

isArrayFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…