While useful, the modulo operator in JavaScript is not infallible when negative numbers are thrown into the mix. For example, -13 % 64 = -13, when the actual answer is 51. Create a function to fix this. It should also work for positive numbers.
mod(-13, 64) ➞ 51
mod(50, 25) ➞ 0
mod(-6, 3) ➞ 0
All test cases contain valid numbers.