long.js
long.js copied to clipboard
Add support for BigInt (closes #82)
There isn't much logic here as BigInt's conversions are being done using its string representations, but I've got tests anyways.
On environments that don't support BigInt, everything else works fine except toBigInt().
Node.js v16.13.1 repl:
> const Long = require('.');
undefined
> Long.fromValue(0).toInt()
0
> Long.fromValue(0).toBigInt()
0n
Node.js v8.17.0 repl:
> const Long = require('.');
undefined
> Long.fromValue(0).toInt()
0
> Long.fromValue(0).toBigInt()
ReferenceError: BigInt is not defined
at Long.toBigInt (/Users/trevorah/Development/long.js/umd/index.js:514:5)