@tmlmobilidade/utils 20250825.1641.39 → 20250825.2309.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Checks if the given latitude value is valid.
2
+ * Checks if the given latitude value is valid given Portugal limits.
3
3
  * @param value The latitude value to check.
4
4
  * @returns True if the latitude is valid, false otherwise.
5
5
  */
6
6
  export declare function isValidLatitude(value: number): boolean;
7
7
  /**
8
- * Checks if the given longitude value is valid.
8
+ * Checks if the given longitude value is valid given Portugal limits.
9
9
  * @param value The longitude value to check.
10
10
  * @returns True if the longitude is valid, false otherwise.
11
11
  */
@@ -1,19 +1,23 @@
1
1
  /* * */
2
2
  /**
3
- * Checks if the given latitude value is valid.
3
+ * Checks if the given latitude value is valid given Portugal limits.
4
4
  * @param value The latitude value to check.
5
5
  * @returns True if the latitude is valid, false otherwise.
6
6
  */
7
7
  export function isValidLatitude(value) {
8
- return value >= -90 && value <= 90;
8
+ const hasValue = value !== undefined && value !== null;
9
+ const isWithinPortugal = value >= 36.9 && value <= 42.0;
10
+ return hasValue && isWithinPortugal;
9
11
  }
10
12
  /**
11
- * Checks if the given longitude value is valid.
13
+ * Checks if the given longitude value is valid given Portugal limits.
12
14
  * @param value The longitude value to check.
13
15
  * @returns True if the longitude is valid, false otherwise.
14
16
  */
15
17
  export function isValidLongitude(value) {
16
- return value >= -180 && value <= 180;
18
+ const hasValue = value !== undefined && value !== null;
19
+ const isWithinPortugal = value >= -9.5 && value <= -6.0;
20
+ return hasValue && isWithinPortugal;
17
21
  }
18
22
  /**
19
23
  * Checks if the given latitude and longitude values form a valid coordinate pair.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/utils",
3
- "version": "20250825.1641.39",
3
+ "version": "20250825.2309.5",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",