mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
34 lines
892 B
TypeScript
34 lines
892 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/modulo.js
|
|
|
|
|
|
import _curry2 from './internal/_curry2.js';
|
|
|
|
|
|
/**
|
|
* Divides the first parameter by the second and returns the remainder. Note
|
|
* that this function preserves the JavaScript-style behavior for modulo. For
|
|
* mathematical modulo see [`mathMod`](#mathMod).
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.1
|
|
* @category Math
|
|
* @sig Number -> Number -> Number
|
|
* @param {Number} a The value to the divide.
|
|
* @param {Number} b The pseudo-modulus
|
|
* @return {Number} The result of `b % a`.
|
|
* @see R.mathMod
|
|
* @example
|
|
*
|
|
* R.modulo(17, 3); //=> 2
|
|
* // JS behavior:
|
|
* R.modulo(-17, 3); //=> -2
|
|
* R.modulo(17, -3); //=> 2
|
|
*
|
|
* const isOdd = R.modulo(R.__, 2);
|
|
* isOdd(42); //=> 0
|
|
* isOdd(21); //=> 1
|
|
*/
|
|
var modulo = _curry2(function modulo(a, b) { return a % b; });
|
|
export default modulo;
|