MCPcopy
hub / github.com/LegendApp/legend-state / assign

Function assign

src/ObservableObject.ts:605–625  ·  view source on GitHub ↗
(node: NodeValue, value: any)

Source from the content-addressed store, hash-verified

603}
604
605function assign(node: NodeValue, value: any) {
606 const proxy = getProxy(node);
607
608 beginBatch();
609
610 if (isPrimitive(node.root._)) {
611 node.root._ = {};
612 }
613
614 // Set inAssign to allow setting on safe observables
615 node.isAssigning = (node.isAssigning || 0) + 1;
616 try {
617 Object.assign(proxy, value);
618 } finally {
619 node.isAssigning--;
620 }
621
622 endBatch();
623
624 return proxy;
625}
626
627function deleteFn(node: NodeValue, key?: string) {
628 // If called without a key, delete by key from the parent node

Callers

nothing calls this directly

Calls 5

beginBatchFunction · 0.90
isPrimitiveFunction · 0.90
endBatchFunction · 0.90
getProxyFunction · 0.85
assignMethod · 0.80

Tested by

no test coverage detected