For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/bigint/min.md.

min (for BigInts) es-toolkit

Returns the smallest BigInt in an array.

const smallest = min(numbers);
Info

This function is available exclusively from es-toolkit/bigint to avoid potential conflicts with similar functions for other numeric types.

Usage

min(nums)

Use min when you want the smallest of several BigInts. Math.min cannot accept BigInts at all, so this is the way to compare them.

import { min } from 'es-toolkit/bigint';

const smallest = min([1n, 5n, 3n]);
console.log(smallest); // 1n

// Works with negative values
console.log(min([-5n, -1n, -3n])); // -5n

Because BigInts are compared exactly, values that number would round to the same thing stay distinguishable.

import { min } from 'es-toolkit/bigint';

// As `number`, both of these are 9007199254740992
console.log(min([9007199254740993n, 9007199254740992n])); // 9007199254740992n

There is no BigInt that means "no minimum" — BigInt has no NaN and no Infinity — so an empty array throws instead of returning a placeholder.

import { min } from 'es-toolkit/bigint';

min([]); // RangeError: Cannot find the minimum of an empty array.

Parameters

numsreadonly bigint[]required

The array of BigInts to search.

Returns

Returns the smallest BigInt in the array.

bigint

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.