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.

24 lines 692 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayMin = void 0; const _debug_js_1 = require("../../debug/_debug.js"); /** * @public * Find the smallest number in an array, if the array is empty the return is Infinity. * * @remarks * See {@link arrayMin}. */ function arrayMin(numbers) { let min = Infinity; for (let i = 0, iEnd = numbers.length; i < iEnd; ++i) { const value = numbers[i]; _BUILD.DEBUG && _debug_js_1._Debug.assert(value === value, "NaN not supported"); if (value < min) { min = value; } } return min; } exports.arrayMin = arrayMin; //# sourceMappingURL=array-min.js.map