@giveback007/util-lib 3.3.1 → 3.3.3
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/package.json +3 -3
- package/src/general.ts +1 -1
- package/src/geo.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giveback007/util-lib",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Utility library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"homepage": "https://github.com/Giveback007/util-lib#readme",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@js-temporal/polyfill": "^0.5.1",
|
|
30
|
-
"tailwind-merge": "^3.
|
|
30
|
+
"tailwind-merge": "^3.4.0",
|
|
31
31
|
"tslib": "^2.8.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"typescript": "^5.9.
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/general.ts
CHANGED
|
@@ -165,7 +165,7 @@ export function promiseOut<T = any>() {
|
|
|
165
165
|
|
|
166
166
|
export async function concurrentTasks<T, Res = any>(
|
|
167
167
|
arr: T[],
|
|
168
|
-
fn: (
|
|
168
|
+
fn: (item: T, arrIdx: number, concurrentIdx: num) => Promise<Res> | Res,
|
|
169
169
|
nOfConcurrentTasks = 8
|
|
170
170
|
): Promise<Res[]> {
|
|
171
171
|
let idx = -1;
|
package/src/geo.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { GeoPoint } from "./@types";
|
|
1
|
+
import type { GeoPoint, num } from "./@types";
|
|
2
2
|
|
|
3
3
|
export const haversineDistance = (
|
|
4
|
-
geo1: GeoPoint | [lat:
|
|
5
|
-
geo2: GeoPoint | [lat:
|
|
4
|
+
geo1: GeoPoint | [lat: num, lon: num],
|
|
5
|
+
geo2: GeoPoint | [lat: num, lon: num],
|
|
6
6
|
type: 'mi' | 'km' = 'km',
|
|
7
7
|
) => {
|
|
8
8
|
let lat1 = 0, lon1 = 0, lat2 = 0, lon2 = 0;
|
|
9
9
|
if (Array.isArray(geo1)) {
|
|
10
10
|
lat1 = geo1[0];
|
|
11
|
-
|
|
11
|
+
lon1 = geo1[1];
|
|
12
12
|
} else {
|
|
13
13
|
lat1 = geo1.lat;
|
|
14
14
|
lon1 = geo1.lon;
|
|
@@ -16,7 +16,7 @@ export const haversineDistance = (
|
|
|
16
16
|
|
|
17
17
|
if (Array.isArray(geo2)) {
|
|
18
18
|
lat2 = geo2[0];
|
|
19
|
-
|
|
19
|
+
lon2 = geo2[1];
|
|
20
20
|
} else {
|
|
21
21
|
lat2 = geo2.lat;
|
|
22
22
|
lon2 = geo2.lon;
|