Right now the only way to retrieve the current tree node children is through the key argument.
This argument should accept a callback that will be called with the current node-element to retrieve the children list.
flatten(tree, (node) => node.children.filter() ... ;