Clean up speed options logic

This commit is contained in:
Sam Potts
2020-02-08 23:09:41 +00:00
parent b5456e1de7
commit 90dc985657
4 changed files with 18 additions and 18 deletions

View File

@@ -21,3 +21,11 @@ export function closest(array, value) {
return array.reduce((prev, curr) => (Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev));
}
export function fillRange(start, end, step = 1) {
const len = Math.floor((end - start) / step) + 1;
return Array(len)
.fill()
.map((_, idx) => start + idx * step);
}