MCPcopy Index your code
hub / github.com/react/react / setInObject

Function setInObject

packages/react-devtools-shared/src/utils.js:670–683  ·  view source on GitHub ↗
(
  object: Object,
  path: Array<string | number>,
  value: any,
)

Source from the content-addressed store, hash-verified

668}
669
670export function setInObject(
671 object: Object,
672 path: Array<string | number>,
673 value: any,
674) {
675 const length = path.length;
676 const last = path[length - 1];
677 if (object != null) {
678 const parent = getInObject(object, path.slice(0, length - 1));
679 if (parent) {
680 parent[last] = value;
681 }
682 }
683}
684
685export type DataType =
686 | 'array'

Callers 3

fillInPathFunction · 0.90
overrideValueAtPathFunction · 0.90
overrideValueAtPathFunction · 0.90

Calls 1

getInObjectFunction · 0.85

Tested by

no test coverage detected