max (for BigInts) es-toolkit
Returns the largest BigInt in an array.
This function is available exclusively from es-toolkit/bigint to avoid potential conflicts with similar functions for other numeric types.
Usage
max(nums)
Use max when you want the largest of several BigInts. Math.max cannot accept BigInts at all, so this is the way to compare them.
Because BigInts are compared exactly, values that number would round to the same thing stay distinguishable.
There is no BigInt that means "no maximum" — BigInt has no NaN and no -Infinity — so an empty array throws instead of returning a placeholder.
Parameters
The array of BigInts to search.
Returns
Returns the largest BigInt in the array.
Throws
Throws a RangeError if the array is empty.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.