bcoin-org / bcoin-org/bcrypto

BigInt function vs BigInt literals

Open
#32 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
102
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Running into a problem with trying to package `bcoin` while uglifying it. The latest version of `uglify-es` still does not support `BigInt` literals, ie `21n`. I think the the parser just hasn't been updated to support that syntax. GitHub also seems to act strangely with their parser, `BigInts` appear highlighted and red.

The `BigInt` function is the same as using a literal. It may be easier to be compatible with the wider JS ecosystem if the function syntax was used, as old parsers will not break on it. Then the `BigInt` functionality could be polyfilled if need be.

```javascript
const a = BigInt(21);
const b = 21n;
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named. Start by locating JavaScript BigInt literal uses and the project's compatibility or packaging checks, then determine whether replacing literals with BigInt(...) preserves behavior. Done means the affected code uses the compatible syntax and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cryptography
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.