Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nafeu/460ac485ec00ae2338ac83d70099c6fe to your computer and use it in GitHub Desktop.
Save nafeu/460ac485ec00ae2338ac83d70099c6fe to your computer and use it in GitHub Desktop.
return existingRows.map((row, index) => {
const isMatchedRowWithSubRows = index === Number(id) && row.subRows;
if (isMatchedRowWithSubRows) {
const [, ...updatedPath] = path;
return {
...row,
subRows: insertIntoTable({
existingRows: row.subRows,
subRowsToInsert,
path: updatedPath
})
}
}
return row;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment