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

Javascript library should do input validation #56

Closed
drinckes opened this issue Nov 25, 2016 · 1 comment
Closed

Javascript library should do input validation #56

drinckes opened this issue Nov 25, 2016 · 1 comment

Comments

@drinckes
Copy link
Contributor

Passing values as strings instead of numbers will produce unexpected results, due to Javascript string handling.

The inputs (lat, lng, code length) should be coerced to numbers (using Number()) and if it produces NaN throw an exception.

While you're there, adding an exported constant for the code length e.g. OpenLocationCode.CODE_PRECISION_NORMAL and OpenLocationCode.CODE_PRECISION_EXTRA seems like a good idea.

@drinckes
Copy link
Contributor Author

This got addressed in #57.

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

1 participant