Upgrades people!

This commit is contained in:
Dunemask 2022-08-09 04:29:10 +00:00
parent f84234150f
commit 8ad56e8d38
40 changed files with 483 additions and 379 deletions

View file

@ -7,25 +7,25 @@ const nest = (arr) => {
};
export const asTree = (branches) => {
const nests = branches.map((b)=>nest(b));
return _.merge(...nests);
};
const nests = branches.map((b) => nest(b));
return _.merge(...nests);
};
export const asBranches = (array) => {
const merged = [];
array.forEach((p, i) => {
p.forEach((v, i) => {
if (!merged[i]) merged[i] = [];
if (!merged[i].includes(v)) merged[i].push(v);
});
const merged = [];
array.forEach((p, i) => {
p.forEach((v, i) => {
if (!merged[i]) merged[i] = [];
if (!merged[i].includes(v)) merged[i].push(v);
});
return merged;
}
});
return merged;
};
export const as1d = (a) => [].concat.apply([], a);
export const selectBranch = (map,test) => {
const pipeline = map.find((pm)=>pm.includes(test));
const testIndex = pipeline.findIndex((t) => t === test);
return pipeline.slice(0, testIndex + 1);
}
export const selectBranch = (map, test) => {
const pipeline = map.find((pm) => pm.includes(test));
const testIndex = pipeline.findIndex((t) => t === test);
return pipeline.slice(0, testIndex + 1);
};