-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: allocate method #410
Labels
Comments
Interesting, I would imagine we could support something similar (as of right now currency.js assumes an equal distribution, and spreads pennies over anything unequal). I'll leave this open to see if anyone else is interested and would provide a proposal on the API. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some other libraries like Dinero.js have an allocate method, similar to
distribute
but taking percentages or ratios. e.g., `currency(2.00).allocate(50, 25, 25) would result in [1.00, 0.50, 0.50].This would be a very useful feature! Are there any plans for it? If not, does anyone have a code snippet that does this for
currency.js
? It's not super hard to implement oneself, which is what I'm doing, but with currency calculation I like to be very careful so any examples are appreciated. The only real complexity is allocating sums that don't nicely distribute over the percentages given.The text was updated successfully, but these errors were encountered: