I need to remove from array
the current object being processed:
arrai = [{parent:1,dialog_node:2}, {parent:1,dialog_node:3}, {parent:1,dialog_node:4}, {parent:9,dialog_node:1}, {parent:9,dialog_node:6}];
tree = {parent:1,dialog_node:2};
arrai.forEach(function(value){
if(tree.parent == value.parent){
node.parent = value.parent;
node.children.push(value.dialog_node);
_.reject(arrai, function(el) {
return el.dialog_node === tree.dialog_node; });
}
});
I would like the elements that fall within if
to be outside the array
at the end.