UNPKG

839 BJavaScriptView Raw
1import _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
28var modulo =
29/*#__PURE__*/
30_curry2(function modulo(a, b) {
31 return a % b;
32});
33
34export default modulo;
\No newline at end of file