parsify-dev / cashify

💸 Lightweight currency conversion library, successor of money.js
MIT License
402 stars 19 forks source link

Correctly handle '0' passed as string to convert() #14

Closed sudomann closed 3 years ago

sudomann commented 3 years ago

The existing version throws:

> // const rates = ...
> convert('0', {from: 'EUR', to: 'XFA', base: 'EUR', rates})
Uncaught:
Error: Could not parse the `amount` argument. Make sure it includes at least a valid amount.
    at Object.parse [as default] (C:\path\to\my\project\node_modules\cashify\dist\utils\parser.js:26:15)
    at convert (C:\path\to\my\project\node_modules\node_modules\cashify\dist\convert.js:28:38)
xxczaki commented 3 years ago

Thanks for spotting this issue! I fixed the parser issue and added additional tests.

sudomann commented 3 years ago

Thanks for spotting this issue! I fixed the parser issue and added additional tests.

Thanks for moving fast on it! 💯