BigInt is a great addition to the JavaScript language, but it's still missing some utilities and features. This project aims to provide some missing utilities and features for BigInt.
This is a mono-repository containing several packages that provide utilities for working with BigInts.
A couple of examples:
bigint
lacks support inMath.max
andMath.min
functions.- The
Buffer
class does not supportbigint
natively. - There is no way to work with bounded
BigInts
(e.g.,uint8
,int8
,uint16
,int16
, etc.). - There is no way to work with
bigint
andUint8Array
natively converting between the two. - Generating a random
bigint
is not possible natively.
Currently, this repo is composed by the following packages:
- @vekexasia/bigint-buffer-polyfill: Buffer polyfill for BigInt
- @vekexasia/bigint-constrained: Bounded BigInts
- @vekexasia/bigint-math: BigInt Math utils
- @vekexasia/bigint-uint8array: Uint8Array conversion from/to BigInt
All the packages are written in TypeScript and come with their own type definitions.
All the packages1 also provide a browser compatible build. Check out the README of each package for more information.
1 exception made for bigint-buffer-polyfill
which does not make sense in a browser environment.
You can find the main typedoc documentation here.
This project is licensed under the MIT License - see the LICENSE file for details.