UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

26 lines 790 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mathMin = void 0; const _debug_js_1 = require("../../debug/_debug.js"); /** * @public * Returns the smaller of the two parameters `a` and `b`. * * @remarks * NaN comparison will cause a debug error. * Differs from Math.min by taking only 2 arguments, avoids overhead of handling variable number of arguments. * * See {@link mathMin}. */ function mathMin(a, b) { _BUILD.DEBUG && _debug_js_1._Debug.runBlock(() => { _debug_js_1._Debug.assert(!isNaN(a), "expected a to be a number"); _debug_js_1._Debug.assert(!isNaN(b), "expected b to be a number"); }); if (a > b) { return b; } return a; } exports.mathMin = mathMin; //# sourceMappingURL=math-min.js.map