Skip to main content

@exodus/bigint

Immutable API wrapper for BigInt numbers.

⚠️ Warning: This package is useful when targeting both JS environments that support BigInt natively and ones that don't. These days you should probably just use BigInt directly.

Usage

import BigIntWrapper from '@exodus/bigint'
// if you're in a JS environment that doesn't support BigInt natively, use the bn.js wrapper
// import BigIntWrapper from '@exodus/bigint/src/bn.js'

const three = BigIntWrapper.wrap(3)
const five = BigIntWrapper.wrap(5)

// perform arithmetic
// see full API: ./src/native-bigint.js and ./src/__tests__/index.test.js
three.add(five).mul(three).div(five).pow(three).sub(five)