UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

12 lines (11 loc) 398 B
export const collapseChild = (node) => { const onlyChild = node.children.values().next().value; const parentKey = node.key; const parent = node.parent; parent.children.set(parentKey, onlyChild); Object.assign(onlyChild, { parent, key: parentKey }); const n = onlyChild.row; n.parentId = parent.kind === "root" ? null : parent.id; n.depth--; return onlyChild; };