Skip to content

feature request: allocate method #410

@NathanC

Description

@NathanC

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions