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

Feature Request - isLatLong(lat-long-pair) #664

Closed
roydondsouza opened this issue May 28, 2017 · 3 comments · Fixed by #684
Closed

Feature Request - isLatLong(lat-long-pair) #664

roydondsouza opened this issue May 28, 2017 · 3 comments · Fixed by #684

Comments

@roydondsouza
Copy link

Support for isLatLong:

var validator = require('validator');
validator.isLatLong('12.0122,-77.00'); => true
var validator = require('validator');
validator.isLatLong('-200.0122,-77.00'); => false

Libraries that currently validate and return lat,long coordinate pairs:
@markstos has forked to-coordinates [that was lacking stricter parsing which he has raised in the issue here: Wish: stricter parsing of lat/long coordinates pairs #2] to create a stricter parsing of lat/long pairs in a wonderful library called parse-coordinates

We could use this to support - isLatLong('12.0122,-77.00') within this library.

If I were to put something together for a PR, do you support reuse of parse-coordinates as a dependency here or write the entire code here?

@roydondsouza roydondsouza changed the title Feature Request - isLatLong(lat,long) Feature Request - isLatLong(latlLongPair) May 28, 2017
@roydondsouza roydondsouza changed the title Feature Request - isLatLong(latlLongPair) Feature Request - isLatLong(lat-long-pair) May 28, 2017
@markstos
Copy link

parse-coordinates already works directly as a validator because a coordinate array casts to a "true" boolean value, while the null returned on a parsing value casts to a "false" boolean value.

The value of adding it to or validator.js would be that it is more convenient to find.

@roydondsouza
Copy link
Author

@markstos thanks for replying. Yes, that was the intention; to use it as an internal dependency within validator.js and make it available for convenience

@roydondsouza
Copy link
Author

roydondsouza commented Aug 26, 2017

Thank you @Charliekenney23, @markstos and @chriso

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

Successfully merging a pull request may close this issue.

3 participants