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
fix(isLatLong): fix bug on isLatLang #1074
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,9 @@ export default function (str) { | |
assertString(str); | ||
if (!str.includes(',')) return false; | ||
const pair = str.split(','); | ||
if ( | ||
(pair[0].charAt(0) === '(' && pair[1].charAt(pair[1].length - 1) !== ')') || | ||
(pair[1].charAt(pair[1].length - 1) === ')' && pair[0].charAt(0) !== '(') | ||
) return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail if
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chriso, will it mean that we have to catch empty validations, for instance when a user passes an empty value for either latitude or longitude? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, disregard my point. I see there's an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The regex |
||
return lat.test(pair[0]) && long.test(pair[1]); | ||
} |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can re-format/write this for better readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work on that @profnandaa.
Thank you.