I am working with a function that looks like this:
public recursiveFilterLayers(node: LayerNode[]): LayerNode[] {
const validItem = node.filter(
(i) => i.visible === true || i.visible === undefined
);
validItem.forEach((i) => {
if (i.children) i.children = this.recursiveFilterLayers(i.children);
});
return validItem;
}
Then I call it using:
data = recursiveFilterLayers(data);
Is there a way to rewrite this function so that I don't have to use the return statement, like this:
recursiveFilterLayers(data);
In other words, how can I modify the function to directly manipulate the reference to the data
array?