performant-array-to-tree
performant-array-to-tree copied to clipboard
feature request: support pick item props
const tree = arrayToTree(arr, {
transform: ['id', 'key1'],
// transform: item => { return { id: item.id, key1: item.key1 } },
});
I would appreciate something like this as well. I don't need parentId once my collection is already hierarchical tree for example. It would be nice to be able to strip it from the results.
Hi everyone, sorry for getting bac to this earlier.
I wanted to eventually review #49 in detail but did not find the time amongst other responsibilities. Since this will not change in the near future, I decided to no longer maintain this repository.
Still, a few thoughts on the idea: I really like the idea of transforming data through a simple callback function. However, I believe it would be better to publish that as an alternative package, since many of the other config options would no longer be needed.
If you do (or did) publish this somewhere for people to use, feel free to add a link to #55.
Thanks!