New: JSBI, a pure-JavaScript BigInt implementation
JSBI makes it possible to use spec-compliant BigInt functionality *today*, in all browsers, without sacrificing compatibility.
https://github.com/GoogleChromeLabs/jsbi …
-
-
Instead of writing code using native BigInt and transpiling down (BigInt → polyfill), developers can now write their code using JSBI for compatibility, and transpile up (polyfill → BigInt) once BigInts are universally supported.
Show this thread -
First one to create a Babel plugin that transpiles JSBI-based code into native BigInt code wins the internet.https://github.com/GoogleChromeLabs/jsbi/issues/2 …
Show this thread -
Kudos to
@JakobKummerow from the@v8js team for creating JSBI! First he adds native BigInt support to@v8js, and now he’s created the JavaScript polyfill too… Thank you Jakob!
Show this thread
End of conversation
New conversation -
-
-
Why? Can a separate file help here?
-
It’s explained in the README I linked to.
- 5 more replies
New conversation -
-
-
Well you *could* transpile every single `a + b` into `isBigInt(a) ? a.add(b) : a + b`, but this would probably result in a slowdown. I wonder if TypeScript could use the type information it already has to do that only as necessary.
-
Indeed. It would bloat the transpiled file size and significantly slow down transpiled code in general. (The README talks about this in some detail, FWIW.)
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.