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

Not async call .convert() for own provided rates #73

Closed
WojtylaCZ opened this issue Nov 7, 2019 · 2 comments
Closed

Not async call .convert() for own provided rates #73

WojtylaCZ opened this issue Nov 7, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@WojtylaCZ
Copy link

Is your feature request related to a problem? Please describe.

I would find very convenient to stay in synchronous context when using the convert() method with own exchange rates. Without using a immediately resolving Promise.

Describe the solution you'd like

Add optional parameter to convert method for object with rates. It will work with CurrencyConverter as the Promise is only for API calls.

Describe alternatives you've considered

Manual conversion with multiplication and creating new Dinero object.

Additional context

Relates to #17

Thank you for your work and the package. Great job! :)

@WojtylaCZ WojtylaCZ added the enhancement New feature or request label Nov 7, 2019
@baskin
Copy link

baskin commented Jul 17, 2020

Same requirement. In my case I use mobx managed exchange rates in a react environment. I'll be forced to run side effects (useEffect hooks etc..) to resolve a promise which I know resolves locally.

vipera added a commit to vipera/dinero.js that referenced this issue Mar 18, 2021
Add an alternative, synchronous API to the async convert() that can be used synchronously when the
exchange rates are known at the moment of conversion.

re dinerojs#73
vipera added a commit to vipera/dinero.js that referenced this issue Mar 18, 2021
Add an alternative, synchronous API to the async convert() that can be used synchronously when the
exchange rates are known at the moment of conversion.

re dinerojs#73
vipera added a commit to vipera/dinero.js that referenced this issue Mar 18, 2021
Add an alternative, synchronous API to the async convert() that can be used synchronously when the
exchange rates are known at the moment of conversion.

re dinerojs#73
vipera added a commit to vipera/dinero.js that referenced this issue Apr 2, 2021
Add an alternative, synchronous API to the async convert() that can be used synchronously when the
exchange rates are known at the moment of conversion.

re dinerojs#73
vipera added a commit to vipera/dinero.js that referenced this issue Apr 2, 2021
Add an alternative, synchronous API to the async convert() that can be used synchronously when the
exchange rates are known at the moment of conversion.

re dinerojs#73
@sarahdayan
Copy link
Collaborator

Hey! I've just released Dinero.js v2 alpha with a much better design for conversions. You can provide rates directly, the responsibility of fetching them isn't coupled to the library.

You can check it out in the API reference.

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
None yet
Development

No branches or pull requests

3 participants