MCPcopy Create free account
hub / github.com/microsoft/SandDance / copyWithSetImpl

Function copyWithSetImpl

docs/external/js/react-dom.development.js:24611–24621  ·  view source on GitHub ↗
(obj, path, idx, value)

Source from the content-addressed store, hash-verified

24609
24610 {
24611 var copyWithSetImpl = function (obj, path, idx, value) {
24612 if (idx >= path.length) {
24613 return value;
24614 }
24615
24616 var key = path[idx];
24617 var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
24618
24619 updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
24620 return updated;
24621 };
24622
24623 var copyWithSet = function (obj, path, value) {
24624 return copyWithSetImpl(obj, path, 0, value);

Callers 1

copyWithSetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected