We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const tree = treeifyPaths([ ['parent', {name: 'a'}], ['parent/child1/1', {name: 'b'}], ['parent/child2', {name: 'c'}], ['parent/child2/1', {name: 'd'}], ['parent/child3', {name: 'e'}], ['parent/child4', {name: 'f'}], ['another', {name: 'g'}], ['another/child1/A/B', {name: 'h'}], ['another/child2/A/B', {name: 'i'}], ]); console.log(JSON.stringify(tree, null, 3));
{ "path": "", "name": "", "children": [ { "path": "another", "name": "another", "children": [ { "path": "another/child1", "name": "", "children": [ { "path": "another/child1/A", "name": "", "children": [ { "path": "another/child1/A/B", "name": "B", "children": [], "ctx": { "name": "h" } } ], "ctx": { "name": "h" } } ], "ctx": { "name": "h" } }, { "path": "another/child2", "name": "", "children": [ { "path": "another/child2/A", "name": "", "children": [ { "path": "another/child2/A/B", "name": "B", "children": [], "ctx": { "name": "i" } } ], "ctx": { "name": "i" } } ], "ctx": { "name": "i" } } ], "ctx": { "name": "i" } }, { "path": "parent", "name": "parent", "children": [ { "path": "parent/child1", "name": "", "children": [ { "path": "parent/child1/1", "name": "1", "children": [], "ctx": { "name": "b" } } ], "ctx": { "name": "b" } }, { "path": "parent/child2", "name": "child2", "children": [ { "path": "parent/child2/1", "name": "1", "children": [], "ctx": { "name": "d" } } ], "ctx": { "name": "d" } }, { "path": "parent/child3", "name": "child3", "children": [], "ctx": { "name": "e" } }, { "path": "parent/child4", "name": "child4", "children": [], "ctx": { "name": "f" } } ], "ctx": { "name": "f" } } ] }
ctx
path
another
name
g
i
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Input
Output
Expected
ctx
withpath
=another
andname
=another
should beg
but noti
.The text was updated successfully, but these errors were encountered: