Skip to content

Instantly share code, notes, and snippets.

@georgeportillo
Created February 21, 2017 19:44
Show Gist options
  • Save georgeportillo/4cce1b93a5f414ea8db4f5a253bd0922 to your computer and use it in GitHub Desktop.
Save georgeportillo/4cce1b93a5f414ea8db4f5a253bd0922 to your computer and use it in GitHub Desktop.
var linked_tree = [{
id: '1-abc'
value: '...'
}, {
id: '2-abc',
parent: '1-abc',
value: '...'
}, {
id: '2-def',
parent: '1-abc',
value: '...'
}, {
id: '3-abc',
parent: '2-abc',
value: '...'
}];
// Convert to
var linked_tree = [{
id: '1-abc'
value: '...',
nodes: [{
id: '2-abc',
parent: '1-abc',
value: '...'
}, {
id: '2-def',
parent: '1-abc',
value: '...',
nodes: [{
id: '3-abc',
parent: '2-abc',
value: '...'
}]
}
}];
@georgeportillo
Copy link
Author

What do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment