@zerodep/is-bigint
TypeScript icon, indicating that this package has built-in type declarations

2.0.9 • Public • Published

@zerodep/is-bigint

version language types license

CodeFactor Known Vulnerabilities

A simple, performant utility to determine if a value is a BigInt.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { isBigInt } from '@zerodep/is-bigint';
// or
const { isBigInt } = require('@zerodep/is-bigint');

Positive Response

isBigInt(1000n); // true
isBigInt(BigInt(Number.MAX_VALUE + 1)); // true

Negative Response

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

/@zerodep/is-bigint/

    Package Sidebar

    Install

    npm i @zerodep/is-bigint

    Homepage

    zerodep.app

    Weekly Downloads

    1

    Version

    2.0.9

    License

    MIT

    Unpacked Size

    4.34 kB

    Total Files

    7

    Last publish

    Collaborators

    • cdepage