Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for BigInt (closes #82) #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

trevorah
Copy link

@trevorah trevorah commented Jan 7, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant