Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vitaleks-project/77fa33d0ea295440f29c1a7148e35c20 to your computer and use it in GitHub Desktop.
Save Vitaleks-project/77fa33d0ea295440f29c1a7148e35c20 to your computer and use it in GitHub Desktop.
Example2.js
// Build folders tree.
// Example how should result looks like
// folderTree = {
// folders: [{
// folders: [{
// id,
// name,
// folders: []
// }]
// }]
// };
const folders = [
{ id: 1, parent: null, name: 'Main videos' },
{ id: 2, parent: 1, name: 'Kitchen videos' },
{ id: 3, parent: 1, name: 'Garden videos' },
{ id: 4, parent: 3, name: 'Garden videos1' },
{ id: 5, parent: 3, name: 'Garden videos2' },
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment