@hebcal/noaa 0.8.5 → 0.8.6

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/dist/cjs/index.js CHANGED
@@ -85,6 +85,11 @@ class GeoLocation {
85
85
  this.elevation = elevation;
86
86
  }
87
87
  setLatitude(latitude) {
88
+ if (typeof latitude !== 'number')
89
+ throw new TypeError('Invalid latitude');
90
+ if (latitude < -90 || latitude > 90) {
91
+ throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
92
+ }
88
93
  this.latitude = latitude;
89
94
  }
90
95
  /**
@@ -94,6 +99,11 @@ class GeoLocation {
94
99
  return this.latitude;
95
100
  }
96
101
  setLongitude(longitude) {
102
+ if (typeof longitude !== 'number')
103
+ throw new TypeError('Invalid longitude');
104
+ if (longitude < -180 || longitude > 180) {
105
+ throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
106
+ }
97
107
  this.longitude = longitude;
98
108
  }
99
109
  /**
package/dist/esm/index.js CHANGED
@@ -82,6 +82,11 @@ export class GeoLocation {
82
82
  this.elevation = elevation;
83
83
  }
84
84
  setLatitude(latitude) {
85
+ if (typeof latitude !== 'number')
86
+ throw new TypeError('Invalid latitude');
87
+ if (latitude < -90 || latitude > 90) {
88
+ throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
89
+ }
85
90
  this.latitude = latitude;
86
91
  }
87
92
  /**
@@ -91,6 +96,11 @@ export class GeoLocation {
91
96
  return this.latitude;
92
97
  }
93
98
  setLongitude(longitude) {
99
+ if (typeof longitude !== 'number')
100
+ throw new TypeError('Invalid longitude');
101
+ if (longitude < -180 || longitude > 180) {
102
+ throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
103
+ }
94
104
  this.longitude = longitude;
95
105
  }
96
106
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/noaa",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "sunrise and sunset via NOAA algorithm with elevation, based on KosherJava",
5
5
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
6
6
  "contributors": [
@@ -40,7 +40,7 @@
40
40
  "dist/*"
41
41
  ],
42
42
  "devDependencies": {
43
- "@types/node": "20.9.3",
43
+ "@types/node": "20.9.4",
44
44
  "gts": "^5.2.0",
45
45
  "typescript": "^5.3.2"
46
46
  },