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

returns -1 for fractional values without leading zero #1

Closed
kylemcdonald opened this issue May 10, 2015 · 3 comments
Closed

returns -1 for fractional values without leading zero #1

kylemcdonald opened this issue May 10, 2015 · 3 comments

Comments

@kylemcdonald
Copy link

> require('numeric-quantity')('0.5')
0.5
> require('numeric-quantity')('.5')
-1
@jakeboone02
Copy link
Owner

@kylemcdonald, this was sort of on purpose, since my original use case didn't need to handle that scenario. I'll take a look at it but would be happy to accept a PR if you want to tackle it yourself.

@kylemcdonald
Copy link
Author

thanks for the clarification @jakeboone02! for now i've switched to eval(str.replace(' ', '+')) which isn't as robust as this lib, but solves my case. if i come back to numeric-quantity i'll patch and PR.

@jakeboone02
Copy link
Owner

This is fixed with fe56479 and released as 0.2.0 on npm. Thanks for the nudge, @kylemcdonald!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants