Comments (1)
It's not a bad idea; very early versions of JSBI did something like this internally.
The biggest issue is the **
operator. As you note, transpilers might eliminate it; that's because without transpilation this code will generate SyntaxErrors on sufficiently old JS engines (IIRC: Node 6, IE11).
So if you don't care about supporting such very old engines, then this solution will probably work just fine for you. Otherwise, JSBI's official conclusion is that using https://github.com/GoogleChromeLabs/babel-plugin-transform-jsbi-to-bigint is more robust, and probably fits many projects' workflows well.
(Aside from that, the good news is that nowadays all major browsers support BigInts (see: https://caniuse.com/bigint), so it's only a question of time until developers can just rely on native BigInts being available. Just a few more years!)
from jsbi.
Related Issues (20)
- Shall `JSBI.valueOf()` try to automatically convert `JSBI` objects to `number` values HOT 2
- TypeError thrown on construction
- How to convert an array back to JSBI HOT 2
- conversion from huge numbers does not match BigInt
- asIntN appears to give wrong value HOT 1
- URGENT 3.2.0 is very broken HOT 8
- CJS Module will not work on browser due to different JSBI's build target HOT 3
- JSBI.EQ implementation bug HOT 1
- Symbol.toPrimitive doesn't exist in IE11 HOT 1
- UMD bundle of v3.2.5 will throw TypeError: h.__initializeDigits is not a function HOT 9
- Error: Convert JSBI instances to native numbers using `toNumber` HOT 3
- SQRT HOT 2
- Error: Convert JSBI instances to native numbers using `toNumber`. HOT 4
- jsbi.d.ts is missing new DataView polyfills HOT 1
- v4.2.2 and v4.3.0 tags HOT 6
- Generate random JSBI numbers to use in tests HOT 2
- Does not work like BigInt HOT 1
- cannot be imported correctly with TypeScript Node 16 module resolution mode HOT 3
- Invalid sourcemap due to missing TS output files in package HOT 3
- Not working for big endian (typedarray) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbi.