]> git.r.bdr.sh - rbdr/canvas/blame - src/lib/math.js
Save WIP
[rbdr/canvas] / src / lib / math.js
CommitLineData
2df937df
RBR
1/**
2 * Modulo that acts well with negative numbers.
3 * @param {number} dividend the number to divide
4 * @param {number} divisor the divisor to calculate the remainder
5 */
587d8fe6
RBR
6export const modulo = function modulo(dividend, divisor) {
7 return ((dividend % divisor) + divisor) % divisor;
2df937df 8};