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.

20 lines 548 B
import { _Debug } from "../../debug/_debug.js"; /** * @public * Find the smallest number in an array, if the array is empty the return is Infinity. * * @remarks * See {@link arrayMin}. */ export function arrayMin(numbers) { let min = Infinity; for (let i = 0, iEnd = numbers.length; i < iEnd; ++i) { const value = numbers[i]; _BUILD.DEBUG && _Debug.assert(value === value, "NaN not supported"); if (value < min) { min = value; } } return min; } //# sourceMappingURL=array-min.js.map