79381409

Date: 2025-01-23 14:13:48
Score: 1
Natty:
Report link
const updatePaths = (items: Item[], parentPath = "", childKey = "sublimit"): Item[] => {
  return items.map((item, index) => {
    const currentPath = `${parentPath}/${index}`;

    return {
      ...item,
      path: currentPath,
      ...(item[childKey] ? { [childKey]: updatePaths(item[childKey] || [], currentPath, childKey) } : {}),
    };
  });
};
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: balaji