-
-
Notifications
You must be signed in to change notification settings - Fork 0
bigint object
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isBigIntObject(it: unknown): it is BigInt;
Checks if a value is a BigInt object, which is a boxed-primitive BigInt that was
created by wrapping a primitive BigInt (bigint) in the Object()
wrapper
function.
Boxed primitives are strongly discouraged in JavaScript, as they can lead to all sorts of unexpected behavior and performance issues. As such, this function - and the other boxed primitive functions like it - are provided for your convenience, to help you easily ensure your code is not on the receiving end of such behavior.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is a boxed-primitive BigInt object; otherwise, false
.
Boxed Primitives
import { isBigIntObject } from "jsr:@nick/is/bigint-object";
isBigIntObject(Object(BigInt("2"))); // true
isBigIntObject(BigInt("2")); // false
isBigIntObject(2n); // false