@autobusal/common 1.15.6 → 1.15.7

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.
Files changed (2) hide show
  1. package/Drive/utilities.ts +18 -3
  2. package/package.json +1 -1
@@ -10,8 +10,20 @@ const STOP_UNDEFINED = ['0', '0'];
10
10
  *
11
11
  * Edited: Ferjolt Ozuni - Date: 2026-08-01
12
12
  */
13
- export const hasPosition = (position?: string[]): boolean => {
14
- if (position === undefined || position.length < 2) {
13
+ export const hasPosition = (position?: unknown): boolean => {
14
+ /**
15
+ * Edited: Ferjolt Ozuni - Date: 2026-08-01
16
+ *
17
+ * Array.isArray, not a length check. A stop whose `location` was stored
18
+ * as {lat, lng} instead of the positional ["lat","lng"] has no `.length`,
19
+ * so `position.length < 2` was false and the row sailed through the
20
+ * guard - then `.map` threw and took the whole route page down with
21
+ * "Because of a system error, we can't display this page!".
22
+ *
23
+ * One malformed stop out of fifty-three should cost that stop its pin,
24
+ * not the page.
25
+ */
26
+ if (!Array.isArray(position) || position.length < 2) {
15
27
  return false;
16
28
  }
17
29
 
@@ -42,7 +54,10 @@ export const getCoordinates = (locations: LocationData[]): number[][] => (
42
54
  );
43
55
 
44
56
  export const getPosition = (position: string[] | undefined, type: string = 'normal'): LatLngExpression => {
45
- if (position === undefined) {
57
+ // Edited: Ferjolt Ozuni - Date: 2026-08-01
58
+ // Anything that is not a positional array yields 0,0 rather than
59
+ // [NaN, NaN], which Leaflet rejects by throwing.
60
+ if (!Array.isArray(position)) {
46
61
  return [0, 0];
47
62
  }
48
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.15.6",
3
+ "version": "1.15.7",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"