UNPKG

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