Skip to content

Commit c27500b

Browse files
author
zesani
authored
fix: switch isLatitude & isLongitude validators (#537)
check if the string is a valid latitude-longitude coordinate in the format lat,long or lat, long.
1 parent b57fef4 commit c27500b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/validation/Validator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,14 @@ export class Validator {
374374
* Checks if a given value is a latitude.
375375
*/
376376
isLatitude(value: unknown): boolean {
377-
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`0,${value}`);
377+
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`${value},0`);
378378
}
379379

380380
/**
381381
* Checks if a given value is a longitude.
382382
*/
383383
isLongitude(value: unknown): boolean {
384-
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`${value},0`);
384+
return (typeof value === "number" || this.isString(value)) && this.isLatLong(`0,${value}`);
385385
}
386386

387387
/**

0 commit comments

Comments
 (0)