mod = (divident, divisor) => {

  const remainder = divident % divisor;

  return Math.floor(remainder >= 0 ? remainder : remainder + divisor);

}
Implementation of the algebraic modulus operation.

In javascript '%' is really a remainder operator, not a modulus.
Algebraically speaking, a modulus operation always yields
positive results, while '%' in js can yield negative results.

Note: divident mod divisor

@param {number} divident
@param {number} divisor
@return {number}