@hebcal/geo-sqlite 5.0.0 → 5.0.1

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v5.0.0 */
1
+ /*! @hebcal/geo-sqlite v5.0.1 */
2
2
  'use strict';
3
3
 
4
4
  var Database = require('better-sqlite3');
@@ -214,15 +214,13 @@ class GeoDb {
214
214
  const zip = result.ZipCode;
215
215
  const tzid = core.Location.getUsaTzid(result.State, result.TimeZone, result.DayLightSaving);
216
216
  const cityDescr = `${result.CityMixedCase}, ${result.State} ${zip}`;
217
- const location = new core.Location(result.Latitude, result.Longitude, false, tzid, cityDescr, 'US', zip);
217
+ const elevation = result?.Elevation > 0 ? result.Elevation : 0;
218
+ const location = new core.Location(result.Latitude, result.Longitude, false, tzid, cityDescr, 'US', zip, elevation);
218
219
  location.admin1 = location.state = result.State;
219
220
  location.stateName = stateNames[location.state];
220
221
  location.geo = 'zip';
221
222
  location.zip = zip;
222
223
  location.population = result.Population;
223
- if (result.Elevation && result.Elevation > 0) {
224
- location.elevation = result.Elevation;
225
- }
226
224
  return location;
227
225
  }
228
226
 
@@ -293,7 +291,8 @@ class GeoDb {
293
291
  const country = result.country || '';
294
292
  const admin1 = result.admin1 || '';
295
293
  const cityDescr = GeoDb.geonameCityDescr(result.name, admin1, country);
296
- const location = new core.Location(result.latitude, result.longitude, result.cc == 'IL', result.timezone, cityDescr, result.cc, geonameid);
294
+ const elevation = result?.elevation > 0 ? result.elevation : 0;
295
+ const location = new core.Location(result.latitude, result.longitude, result.cc == 'IL', result.timezone, cityDescr, result.cc, geonameid, elevation);
297
296
  location.geo = 'geoname';
298
297
  location.geonameid = geonameid;
299
298
  location.asciiname = result.asciiname;
@@ -306,9 +305,6 @@ class GeoDb {
306
305
  if (result.population) {
307
306
  location.population = result.population;
308
307
  }
309
- if (result.elevation && result.elevation > 0) {
310
- location.elevation = result.elevation;
311
- }
312
308
  return location;
313
309
  }
314
310
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/geo-sqlite v5.0.0 */
1
+ /*! @hebcal/geo-sqlite v5.0.1 */
2
2
  import Database from 'better-sqlite3';
3
3
  import { Location, Locale } from '@hebcal/core';
4
4
  import '@hebcal/cities';
@@ -212,15 +212,13 @@ class GeoDb {
212
212
  const zip = result.ZipCode;
213
213
  const tzid = Location.getUsaTzid(result.State, result.TimeZone, result.DayLightSaving);
214
214
  const cityDescr = `${result.CityMixedCase}, ${result.State} ${zip}`;
215
- const location = new Location(result.Latitude, result.Longitude, false, tzid, cityDescr, 'US', zip);
215
+ const elevation = result?.Elevation > 0 ? result.Elevation : 0;
216
+ const location = new Location(result.Latitude, result.Longitude, false, tzid, cityDescr, 'US', zip, elevation);
216
217
  location.admin1 = location.state = result.State;
217
218
  location.stateName = stateNames[location.state];
218
219
  location.geo = 'zip';
219
220
  location.zip = zip;
220
221
  location.population = result.Population;
221
- if (result.Elevation && result.Elevation > 0) {
222
- location.elevation = result.Elevation;
223
- }
224
222
  return location;
225
223
  }
226
224
 
@@ -291,7 +289,8 @@ class GeoDb {
291
289
  const country = result.country || '';
292
290
  const admin1 = result.admin1 || '';
293
291
  const cityDescr = GeoDb.geonameCityDescr(result.name, admin1, country);
294
- const location = new Location(result.latitude, result.longitude, result.cc == 'IL', result.timezone, cityDescr, result.cc, geonameid);
292
+ const elevation = result?.elevation > 0 ? result.elevation : 0;
293
+ const location = new Location(result.latitude, result.longitude, result.cc == 'IL', result.timezone, cityDescr, result.cc, geonameid, elevation);
295
294
  location.geo = 'geoname';
296
295
  location.geonameid = geonameid;
297
296
  location.asciiname = result.asciiname;
@@ -304,9 +303,6 @@ class GeoDb {
304
303
  if (result.population) {
305
304
  location.population = result.population;
306
305
  }
307
- if (result.elevation && result.elevation > 0) {
308
- location.elevation = result.elevation;
309
- }
310
306
  return location;
311
307
  }
312
308
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/geo-sqlite",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal"