We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6652f40 commit 18b8f00Copy full SHA for 18b8f00
src/types/isValidMarker.ts
@@ -14,6 +14,13 @@ export const isValidLongitude = (value: unknown): value is number => {
14
return typeof value === "number" && value >= -180 && value <= 180;
15
};
16
17
+/**
18
+ * Checks if value is a valid [latitude, longitude] tuple.
19
+ */
20
+export const isValidLatLngTuple = (value: unknown): value is [number, number] => {
21
+ return Array.isArray(value) && value.length === 2 && isValidLatitude(value[0]) && isValidLongitude(value[1]);
22
+};
23
+
24
/**
25
* Type guard that validates a MarkerProps object at runtime
26
* and narrows lat/lng from unknown to number.
0 commit comments