A simple, performant utility to determine if a value is a BigInt.
Full documentation is available at the zerodep.app page.
All @zerodep packages support both ESM and CJS.
import { isBigInt } from '@zerodep/is-bigint';
// or
const { isBigInt } = require('@zerodep/is-bigint');
isBigInt(1000n); // true
isBigInt(BigInt(Number.MAX_VALUE + 1)); // true
isBigInt(['a', 'b', 'c']); // false
isBigInt(true); // false
isBigInt(new Date()); // false
isBigInt(''); // false
isBigInt(new Error('message')); // false
isBigInt(3.14); // false
isBigInt(() => 'function'); // false
isBigInt(42); // false
isBigInt(
new Map([
['a', 1],
['b', 2],
])
); // false
isBigInt(null); // false
isBigInt({ an: 'object' }); // false
isBigInt(new Promise(() => {})); // false
isBigInt(/[regex]+/gi); // false
isBigInt(new Set([1, 2, 3])); // false
isBigInt('a string'); // false
isBigInt(Symbol()); // false
isBigInt(new Int32Array(2)); // false
isBigInt(undefined); // false