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

Issue with type Double/Int #12

Closed
DKalachniuk opened this issue Jan 20, 2017 · 3 comments · Fixed by #13
Closed

Issue with type Double/Int #12

DKalachniuk opened this issue Jan 20, 2017 · 3 comments · Fixed by #13
Assignees
Labels

Comments

@DKalachniuk
Copy link
Contributor

DKalachniuk commented Jan 20, 2017

if I do

try? JSON(0.0).value() as Int

this equals to nil as well as the opposite:

try? JSON(-5).value() as Double

is also nil

@alickbass
Copy link
Owner

Thanks for submitting the issue! This is definitely a bug that was caused by the fact that value() method uses the method that returns Any. I will resolve this issue in short notice.

@alickbass alickbass self-assigned this Jan 20, 2017
@alickbass alickbass added the bug label Jan 20, 2017
@DKalachniuk
Copy link
Contributor Author

Thank you
currently as a workaround, I'm using

?? 0.0

cost = object.value(for: .cost,.r180) ?? 0.0

@alickbass
Copy link
Owner

Indeed, this can be a temp fix, but it won't give you an error if, for example, you will receive String instead of a Number

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

Successfully merging a pull request may close this issue.

2 participants