master
Matthew Huntington 3 years ago
parent 0cfd96b813
commit 6f9177bacf

@ -41,7 +41,7 @@ const breakDown = (node)=>{
const tree = breakDown({value:9});
console.dir(tree, {depth:null});
//console.dir(tree, {depth:null});
const getLeaves = (node)=>{
if(node.twoPath === undefined){
@ -58,8 +58,9 @@ const getLeaves = (node)=>{
if(Number.isInteger(twoPathRightValue[0])){
twoPathRightValue.unshift(twoPathLeftValue);
} else {
twoPathRightValue[0].unshift(twoPathLeftValue)
twoPathRightValue[1].unshift(twoPathLeftValue);
for(let subArray of twoPathRightValue){
subArray.unshift(twoPathLeftValue);
}
}
twoPathResult = twoPathRightValue;
}
@ -97,7 +98,11 @@ const getLeaves = (node)=>{
if(Number.isInteger(threePathResult)){
twoPathResult.push(threePathResult)
} else {
twoPathResult.push(threePathResult[0])
if(Number.isInteger(threePathResult[0])){
twoPathResult.push(threePathResult)
} else {
twoPathResult = twoPathResult.concat(threePathResult);
}
}
return twoPathResult;
}

Loading…
Cancel
Save