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

Function deletePathInObject

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

Source from the content-addressed store, hash-verified

629}
630
631export function deletePathInObject(
632 object: Object,
633 path: Array<string | number>,
634) {
635 const length = path.length;
636 const last = path[length - 1];
637 if (object != null) {
638 const parent = getInObject(object, path.slice(0, length - 1));
639 if (parent) {
640 if (isArray(parent)) {
641 parent.splice(((last: any): number), 1);
642 } else {
643 delete parent[last];
644 }
645 }
646 }
647}
648
649export function renamePathInObject(
650 object: Object,

Callers 2

deletePathFunction · 0.90
deletePathFunction · 0.90

Calls 2

getInObjectFunction · 0.85
isArrayFunction · 0.85

Tested by

no test coverage detected