frontend/.pnpm-store/v3/files/d8/d3ea941f260e8533d979268fbaad379d8650ac0fb5ff7e65a0d70fcccb7327036bffee0db50efa10c0560950b3a7b08468dc1407f445acb880f178d72a35d6

28 lines
632 B
Plaintext

# BigInt
_bigint_ primitive
## `big-int/coerce`
BigInt coercion. If value can be coerced by `BigInt` its result is returned.
For all other values `null` is returned
```javascript
const coerceToBigInt = require("type/big-int/coerce");
coerceToBigInt(12); // 12n
coerceToBigInt(undefined); // null
```
## `big-int/ensure`
If given argument is a _bigint_ coercible value (via [`big-int/coerce`](#big-intcoerce)) returns result bigint.
Otherwise `TypeError` is thrown.
```javascript
const ensureBigInt = require("type/big-int/ensure");
ensureBigInt(12); // 12n
ensureBigInt(null); // Thrown TypeError: null is not a bigint
```