You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
839 B

4 years ago
  1. import _curry2 from "./internal/_curry2.js";
  2. /**
  3. * Divides the first parameter by the second and returns the remainder. Note
  4. * that this function preserves the JavaScript-style behavior for modulo. For
  5. * mathematical modulo see [`mathMod`](#mathMod).
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.1.1
  10. * @category Math
  11. * @sig Number -> Number -> Number
  12. * @param {Number} a The value to the divide.
  13. * @param {Number} b The pseudo-modulus
  14. * @return {Number} The result of `b % a`.
  15. * @see R.mathMod
  16. * @example
  17. *
  18. * R.modulo(17, 3); //=> 2
  19. * // JS behavior:
  20. * R.modulo(-17, 3); //=> -2
  21. * R.modulo(17, -3); //=> 2
  22. *
  23. * const isOdd = R.modulo(R.__, 2);
  24. * isOdd(42); //=> 0
  25. * isOdd(21); //=> 1
  26. */
  27. var modulo =
  28. /*#__PURE__*/
  29. _curry2(function modulo(a, b) {
  30. return a % b;
  31. });
  32. export default modulo;