replace lodash function

main
Yanick Champoux 2022-03-19 19:21:49 -04:00
parent d21f07929d
commit 4f9c70020a
1 changed files with 2 additions and 5 deletions

View File

@ -53,7 +53,6 @@
function setArcs(firstArc) { function setArcs(firstArc) {
console.log(firstArc);
if (nbrArcs === "broadside") { if (nbrArcs === "broadside") {
arcs = broadside; arcs = broadside;
return; return;
@ -61,12 +60,10 @@
let first_index = all_arcs.findIndex((arc) => arc === firstArc); let first_index = all_arcs.findIndex((arc) => arc === firstArc);
if (first_index === -1) first_index = 0; if (first_index === -1) first_index = 0;
console.log({arcs, label:"before"}); arcs = Array.from({length: nbrArcs}).map(
arcs = _.range(nbrArcs).map( (_dummy,i) => all_arcs[(first_index + i) % all_arcs.length]
(i) => all_arcs[(first_index + i) % all_arcs.length]
); );
arcsCaches = arcs.join(','); arcsCaches = arcs.join(',');
console.log({arcs, label:"after"});
} }
$: if (arcs.length !== nbrArcs) setArcs(arcs[0]); $: if (arcs.length !== nbrArcs) setArcs(arcs[0]);