Skip to content
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

Implement toJSON method #34

Open
frolovdev opened this issue May 14, 2020 · 0 comments
Open

Implement toJSON method #34

frolovdev opened this issue May 14, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@frolovdev
Copy link
Owner

Is your feature request related to a problem? Please describe.
Any web application operates with JSON, many API often both receive JSON and send in a monetary format.

Describe the solution you'd like
We need to add the toJson method, which returns something like:

"{"amount":5,"currency":"USD"}"

Example

createMoney({ amount: 5, currency: "USD" }).toJSON()
// => "{"amount":5,"currency":"USD"}"

Don't forget that Currency can be also an Object type, it's also need serialization method.

Packages:

  • @easymoney/money
  • @easymoney/bignumber.js
  • @easymoney/bignumber-money
@frolovdev frolovdev added the enhancement New feature or request label May 14, 2020
@frolovdev frolovdev added this to To do in High-level Roadmap May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant