@lyxa.ai/types 1.3.185 → 1.3.186

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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.185
25
+ Version: 1.3.186
26
26
 
27
27
  ## Dependencies
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.185",
3
+ "version": "1.3.186",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -0,0 +1 @@
1
+ export declare function haversineDistance(coord1: [number, number], coord2: [number, number]): number;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.haversineDistance = haversineDistance;
4
+ function haversineDistance(coord1, coord2) {
5
+ const [lat1, lon1] = coord1;
6
+ const [lat2, lon2] = coord2;
7
+ const R = 6371;
8
+ const dLat = ((lat2 - lat1) * Math.PI) / 180;
9
+ const dLon = ((lon2 - lon1) * Math.PI) / 180;
10
+ const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
11
+ Math.cos((lat1 * Math.PI) / 180) *
12
+ Math.cos((lat2 * Math.PI) / 180) *
13
+ Math.sin(dLon / 2) *
14
+ Math.sin(dLon / 2);
15
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
16
+ return R * c;
17
+ }
18
+ //# sourceMappingURL=distance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distance.js","sourceRoot":"/","sources":["utilities/shared/distance.ts"],"names":[],"mappings":";;AAMA,8CAcC;AAdD,SAAgB,iBAAiB,CAAC,MAAwB,EAAE,MAAwB;IACnF,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAC7C,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAC7C,MAAM,CAAC,GACN,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACrB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC","sourcesContent":["/**\n * Calculates the Haversine distance between two coordinates.\n * @param coord1 [latitude, longitude]\n * @param coord2 [latitude, longitude]\n * @returns straight line distance in KM\n */\nexport function haversineDistance(coord1: [number, number], coord2: [number, number]): number {\n\tconst [lat1, lon1] = coord1;\n\tconst [lat2, lon2] = coord2;\n\tconst R = 6371;\n\tconst dLat = ((lat2 - lat1) * Math.PI) / 180;\n\tconst dLon = ((lon2 - lon1) * Math.PI) / 180;\n\tconst a =\n\t\tMath.sin(dLat / 2) * Math.sin(dLat / 2) +\n\t\tMath.cos((lat1 * Math.PI) / 180) *\n\t\t\tMath.cos((lat2 * Math.PI) / 180) *\n\t\t\tMath.sin(dLon / 2) *\n\t\t\tMath.sin(dLon / 2);\n\tconst c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\treturn R * c;\n}\n"]}