This commit is contained in:
Ahmed Bouhuolia
2020-03-16 00:06:15 +02:00
parent 56701951b7
commit 73711384f6
7925 changed files with 18478 additions and 959 deletions

View File

@@ -12,9 +12,6 @@ export default class NestedSet {
};
this.items = items;
this.collection = {};
this.toTree();
return this.collection;
}
/**
@@ -49,25 +46,32 @@ export default class NestedSet {
}
});
this.collection = Object.values(tree);
return this.collection;
}
walk() {
getTree() {
return this.collection;
}
getParents() {
flattenTree(nodeMapper) {
const flattenTree = [];
}
const traversal = (nodes, parentNode) => {
nodes.forEach((node) => {
let nodeMapped = node;
getChildren() {
}
if (typeof nodeMapper === 'function') {
nodeMapped = nodeMapper(nodeMapped, parentNode);
}
flattenTree.push(nodeMapped);
toFlattenArray() {
}
toArray() {
if (node.children && node.children.length > 0) {
traversal(node.children, node);
}
});
};
traversal(this.collection);
return flattenTree;
}
}