Closed tremendus closed 1 year ago
@tremendus good idea! I have a lot of work right now. I can do this next week. Or you can transform your list now.
...
{
meta: {
parent: 'abc-123'
}
}
to
...
{
parent: 'abs-123',
meta: {
parent: 'abc-123'
}
}
https://github.com/DenQ/list-to-tree/blob/06f51966783687eff82645b96de136a6a8bd2853/dist/list-to-tree.js#L39
I have a need to generate a tree from a collection (array of objects). But my paths are nested - eg:
I need to either pass dot-notation paths (and use a third party lib, like _ or object-path) or, to avoid dependencies, perhaps consider passing a matching fn to the constructor, which I can use third party libs without affecting deps on this module.
Then you could pass whatever id-to-id matching fns you need.
Now I can use:
Thoughts?