Skip to content

Commit

Permalink
fix: switch isLatitude & isLongitude validators (#537)
Browse files Browse the repository at this point in the history
check if the string is a valid latitude-longitude coordinate in the format lat,long or lat, long.
  • Loading branch information
zesani authored Mar 26, 2020
1 parent b57fef4 commit c27500b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/validation/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ export class Validator {
* Checks if a given value is a latitude.
*/
isLatitude(value: unknown): boolean {
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`0,${value}`);
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`${value},0`);
}

/**
* Checks if a given value is a longitude.
*/
isLongitude(value: unknown): boolean {
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`${value},0`);
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`0,${value}`);
}

/**
Expand Down

0 comments on commit c27500b

Please sign in to comment.