var performantArrayToTree = require("performant-array-to-tree")
console.log(performantArrayToTree.arrayToTree([
{ num: "4", ref: "31", custom: "abc" },
{ num: "31", ref: "4", custom: "12" },
],
{ id: "num", parentId: "ref", childrenField: "nodes", throwIfOrphans: true }
));
// result = []
Actually, I don't have a strong opinion on the expected result from this situation. But it seems strange that the lib silently cut an array. Probably it should be an error?