Remove recursion from mod

This commit is contained in:
alex 2022-04-22 17:01:28 +01:00
parent 1029f8674c
commit 3742bf384c

View File

@ -27,7 +27,7 @@ export const fromMidi = (n) => {
// modulo that works with negative numbers e.g. mod(-1, 3) = 2
// const mod = (n: number, m: number): number => (n < 0 ? mod(n + m, m) : n % m);
export const mod = (n, m) => (n < 0 ? mod(n + m, m) : n % m);
export const mod = (n, m) => (n % m + m) % m;
export const getPlayableNoteValue = (event) => {
let { value: note, context } = event;