@trashpanda001/helpers
    Preparing search index...

    Function mod

    • Computes the modulo remainder of a division.

      The result will always have the sign of the divisor. This differs from the % operator in JavaScript, which is really the remainder operator.

      Parameters

      • dividend: number

        the number to be divided

      • divisor: number

        the number to divide by

      Returns number

      the modulo remainder with the sign of the divisor

      RangeError if divisor is zero

      import { mod } from "@trashpanda001/helpers/number"

      mod(5, 2)
      // 1
      mod(-5, 2)
      // 1 .. where as -5 % 2 is -1