justmoon / node-bignum

Big integers for Node.js using OpenSSL
419 stars 116 forks source link

[Discussion] Any plans to support/fallback to native JavaScript BigInt? #114

Open jayands opened 6 years ago

jayands commented 6 years ago

JS now has a BigInt syntax that's at stage 3. We might see it in ES2019 or 2020. Any plans to support the syntax for it, so as to provide a cross-platform (i.e., pre-Node 10.7) support for at least the string syntax so that people that have to develop for older stuff can take advantage of coming native support? it could even be a "future mode", a la python:

import BigInt from 'bignum/future';

const b = BigInt('782910138827292261791972728324982n')
    .sub('182373273283402171237474774728373n')
    .div('8n'); // or 8 the number

console.log(b); // '75067108192986261319312244199576n', as a string
tracker1 commented 5 years ago

Should probably at least add a note towards the top of the README file that notes that one should favor BigInt if available (node 10.4+ etc), with a link to MDN.