Coder Social home page Coder Social logo

bigint-money's Introduction

My projects:

  • 🔗 Ketting - The (current) best HATEOAS client for Javascript
  • Curveball - A modern server-side Node.js framework (like Express)
  • 🔐 a12nserver - A12nServer - A ready-to-launch identity, authentication and authorization server.

Read my blog

Want to hire me? I run a small agency in Toronto called Bad Gateway. Hire us!.

You can also sponsor me directly and support my Open Source work.

bigint-money's People

Contributors

dependabot[bot] avatar evert avatar flaktack avatar greenkeeper[bot] avatar oliverlj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bigint-money's Issues

Use JSBI instead of BigInt until BigInt is widely-supported

Thanks for this library, great work!

Google Chrome team has a JS-only implementation of BigInt for environments that don't support BigInt natively yet: https://github.com/GoogleChromeLabs/jsbi

It follows the official spec. They claim its performance is comparable with V8's native implementation and there's a Babel plugin to transform the code to use the native API when it's more widely-available.

Have you seen it / have you considered using it instead?

umd support for unpkg ?

Hello
Can you add umd build ?

Why

This library is made for computation and in order to be use in web workers, a umd build would be great.

From unpkg docs :

Workflow
For npm package authors, unpkg relieves the burden of publishing your code to a CDN in addition to the npm registry. All you need to do is include your UMD build in your npm package (not your repo, that's different!).

You can do this easily using the following setup:

Add the umd (or dist) directory to your .gitignore file
Add the umd directory to your files array in package.json
Use a build script to generate your UMD build in the umd directory when you publish
That's it! Now when you npm publish you'll have a version available on unpkg as well.

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.7.0 to 12.7.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

not working

Included it in a ember project: add i got this issue 👍

ERROR in ./node_modules/bigint-money/dist/util.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /home/oliver/git/fritzy-front/node_modules/bigint-money/dist/util.js: Identifier directly after number (10:24)

   8 | exports.PRECISION = BigInt(exports.PRECISION_I);
   9 | // Multiplication factor for internal values
> 10 | exports.PRECISION_M = 10n ** exports.PRECISION;
     |                         ^
  11 | var Round;
  12 | (function (Round) {
  13 |     // The following rules are round to the nearest integer, but have different
    at Parser.raise (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:7044:17)
    at Parser.readNumber (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:7979:18)
    at Parser.getTokenFromCode (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:7686:14)
    at Parser.nextToken (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:7268:12)
    at Parser.next (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:7197:10)
    at Parser.parseMaybeAssign (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:9096:12)
    at Parser.parseExpression (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:9017:23)
    at Parser.parseStatementContent (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:10853:23)
    at Parser.parseStatement (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:10724:17)
    at Parser.parseBlockOrModuleBlockBody (/home/oliver/git/fritzy-front/node_modules/@babel/parser/lib/index.js:11298:25)

The number N is not a "safe" integer. It must be converted before passing it

Hello, I have another issue while using your lib, can you take a look?
So I have an wallet app that needs to convert currencies
Here is my code

function convertMoney(
    moneyObject: Money,
    currencyName: CurrencyName,
    rates: FiatRates & AssetRates,
) {
    const rate = rates[moneyObject.currency as CurrencyName][currencyName];

    return moneyObject.multiply(rate);
}

const exchangeRates = {
   BTC: { USD: 30161.68359375 },
   ...
}
const assetAmount = new Money(balance, "BTC"); // balance is bigint -> i.e. BigInt(0) now
const fiatAmount = convertMoney(assetAmount, fiatCurrency.code, exchangeRates) //Error: The number 30161.68359375 is not a "safe" integer. It must be converted before passing it

And when I try to call this function I get Error: The number 30161.68359375 is not a "safe" integer. It must be converted before passing it

Publish ES module along with CJS

First of all, thanks for creating this module! It's been super helpful for me. One thing that would be great to have is the module in ESM version, as I'm using ESM + TS, and would love to use this without having to compile the source code of this library myself.

If you don't have the time to work on this yourself, please let me know. I'm no expert in TS, but I'd be happy to try and work on this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.