@angelrove/forecast-utils 1.1.29 → 1.1.30
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.
|
@@ -2,4 +2,4 @@ import type { ForecastData } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Custom hook to fetch hourly forecast data for a given location and number of days from OpenMeteo API.
|
|
4
4
|
*/
|
|
5
|
-
export declare function useForecastHourly(lat: number, lon: number, dayNum: number): ForecastData;
|
|
5
|
+
export declare function useForecastHourly(lat: number | false, lon: number | false, dayNum: number | false): ForecastData | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jose Angel Romero Vegas",
|
|
3
3
|
"name": "@angelrove/forecast-utils",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.30",
|
|
5
5
|
"description": "Utilities for obtaining weather and astronomy forecast data.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"homepage": "https://github.com/angelrove/forecast-utils",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"docs": "typedoc"
|
|
13
|
+
"docs": "typedoc",
|
|
14
|
+
"dev": "tsc -w"
|
|
14
15
|
},
|
|
15
16
|
"types": "dist/types/index.d.ts",
|
|
16
17
|
"exports": {
|
|
@@ -9,14 +9,14 @@ import transformer from "./transformer.js";
|
|
|
9
9
|
* https://api.open-meteo.com/v1/forecast?timezone=auto&latitude=36.6644363&longitude=-4.5108962&forecast_days=10&daily=weathercode
|
|
10
10
|
*/
|
|
11
11
|
export function useForecastDaily(
|
|
12
|
-
lat: number
|
|
13
|
-
lon: number
|
|
12
|
+
lat: number,
|
|
13
|
+
lon: number,
|
|
14
14
|
refreshIntervalMin: number = 0): ForecastData
|
|
15
15
|
{
|
|
16
16
|
// Validate --
|
|
17
|
-
if (lat == null || lon == null) {
|
|
18
|
-
|
|
19
|
-
}
|
|
17
|
+
// if (lat == null || lon == null) {
|
|
18
|
+
// throw new Error("useForecastDaily: invalid coordinates");
|
|
19
|
+
// }
|
|
20
20
|
|
|
21
21
|
// Fetch --
|
|
22
22
|
const apiUrl = getPath(lat, lon, fetchParams);
|
|
@@ -18,7 +18,7 @@ export function useForecastHourly(
|
|
|
18
18
|
const shouldFetch = lat !== false && lon !== false && dayNum !== false;
|
|
19
19
|
|
|
20
20
|
if (lat == null || lon == null) {
|
|
21
|
-
throw new Error("useForecastHourly: invalid
|
|
21
|
+
throw new Error("useForecastHourly: invalid coordinates");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Fetch ---
|