Comparing version 8.0.2 to 8.1.0
@@ -1,2 +0,2 @@ | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=require("../data/timezones-1970.geojson.index.json"),m=a.join(__dirname,"..","data","timezones-1970.geojson.geo.dat");function z(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(E,m,t)}z(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(E,s,m,t,e)},exports.preCache=function(){z({preload:!0})},exports.setCache=z; | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=process.env.GEO_TZ_DATA_PATH||a.join(__dirname,"..","data"),m=require("../data/timezones-1970.geojson.index.json"),z=a.join(E,"timezones-1970.geojson.geo.dat");function T(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(m,z,t)}T(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(m,s,z,t,e)},exports.preCache=function(){T({preload:!0})},exports.setCache=T; | ||
//# sourceMappingURL=find-1970.js.map |
@@ -1,2 +0,2 @@ | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=require("../data/timezones.geojson.index.json"),m=a.join(__dirname,"..","data","timezones.geojson.geo.dat");function z(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(E,m,t)}z(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(E,s,m,t,e)},exports.preCache=function(){z({preload:!0})},exports.setCache=z; | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=process.env.GEO_TZ_DATA_PATH||a.join(__dirname,"..","data"),m=require("../data/timezones.geojson.index.json"),z=a.join(E,"timezones.geojson.geo.dat");function T(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(m,z,t)}T(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(m,s,z,t,e)},exports.preCache=function(){T({preload:!0})},exports.setCache=T; | ||
//# sourceMappingURL=find-all.js.map |
@@ -1,2 +0,2 @@ | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=require("../data/timezones-now.geojson.index.json"),m=a.join(__dirname,"..","data","timezones-now.geojson.geo.dat");function z(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(E,m,t)}z(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(E,s,m,t,e)},exports.preCache=function(){z({preload:!0})},exports.setCache=z; | ||
var t=require("path"),e=require("fs"),r=require("geobuf"),i=require("@turf/boolean-point-in-polygon"),o=require("@turf/helpers"),n=require("pbf");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function d(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e}var a=/*#__PURE__*/d(t),c=/*#__PURE__*/d(e),l=/*#__PURE__*/f(i),u=/*#__PURE__*/f(n),g=[{tzid:"Etc/GMT-12",left:172.5,right:180},{tzid:"Etc/GMT-11",left:157.5,right:172.5},{tzid:"Etc/GMT-10",left:142.5,right:157.5},{tzid:"Etc/GMT-9",left:127.5,right:142.5},{tzid:"Etc/GMT-8",left:112.5,right:127.5},{tzid:"Etc/GMT-7",left:97.5,right:112.5},{tzid:"Etc/GMT-6",left:82.5,right:97.5},{tzid:"Etc/GMT-5",left:67.5,right:82.5},{tzid:"Etc/GMT-4",left:52.5,right:67.5},{tzid:"Etc/GMT-3",left:37.5,right:52.5},{tzid:"Etc/GMT-2",left:22.5,right:37.5},{tzid:"Etc/GMT-1",left:7.5,right:22.5},{tzid:"Etc/GMT",left:-7.5,right:7.5},{tzid:"Etc/GMT+1",left:-22.5,right:-7.5},{tzid:"Etc/GMT+2",left:-37.5,right:-22.5},{tzid:"Etc/GMT+3",left:-52.5,right:-37.5},{tzid:"Etc/GMT+4",left:-67.5,right:-52.5},{tzid:"Etc/GMT+5",left:-82.5,right:-67.5},{tzid:"Etc/GMT+6",left:-97.5,right:-82.5},{tzid:"Etc/GMT+7",left:-112.5,right:-97.5},{tzid:"Etc/GMT+8",left:-127.5,right:-112.5},{tzid:"Etc/GMT+9",left:-142.5,right:-127.5},{tzid:"Etc/GMT+10",left:-157.5,right:-142.5},{tzid:"Etc/GMT+11",left:-172.5,right:-157.5},{tzid:"Etc/GMT+12",left:-180,right:-172.5}];function h(t){if(-180===t||180===t)return["Etc/GMT+12","Etc/GMT-12"];for(var e=[],r=0;r<g.length;r++){var i=g[r];if(i.left<=t&&i.right>=t)e.push(i.tzid);else if(i.right<t)break}return e}function p(t,e,i,o){void 0===o&&(o=-1);var n=o;if(n<0&&(n=c.openSync(t,"r"))<0)throw new Error("Failed to open geo.dat file");var f=Buffer.alloc(i),d=c.readSync(n,f,0,i,e);if(o<0&&c.closeSync(n),d<i)throw new Error("tried to read "+i+" bytes from geo.dat but only got "+d+" bytes");var a=new u.default(f);return r.decode(a)}var s,E=process.env.GEO_TZ_DATA_PATH||a.join(__dirname,"..","data"),m=require("../data/timezones-now.geojson.index.json"),z=a.join(E,"timezones-now.geojson.geo.dat");function T(t){s=function(t,e,r){var i;if(i=r&&r.store&&"function"==typeof r.store.get&&"function"==typeof r.store.set?r.store:new Map,r&&r.preload){var o=c.openSync(e,"r");if(o<0)throw new Error("Failed to open geo.dat file");!function(t,e,r,i){!function t(o,n){if(o.pos>=0&&o.len){var f=p(e,o.pos,o.len,r);i.set(n,f)}else"object"==typeof o&&Object.getOwnPropertyNames(o).forEach(function(e){t(o[e],n+e)})}(t.lookup,"")}(t,e,o,i),c.closeSync(o)}return i}(m,z,t)}T(),exports.find=function(t,e){return function(t,e,r,i,n){var f=n;if(isNaN(i)||i>90||i<-90)throw new Error("Invalid latitude: "+i);if(isNaN(n)||n>180||n<-180)throw new Error("Invalid longitude: "+n);if(90===i)return g.map(function(t){return t.tzid});i>=89.9999?i=89.9999:i<=-89.9999&&(i=-89.9999),n>=179.9999?n=179.9999:n<=-179.9999&&(n=-179.9999);for(var d=o.point([n,i]),a={top:89.9999,bottom:-89.9999,left:-179.9999,right:179.9999,midLat:0,midLon:0},c="",u=t.lookup;;){var s=void 0;if(i>=a.midLat&&n>=a.midLon?(s="a",a.bottom=a.midLat,a.left=a.midLon):i>=a.midLat&&n<a.midLon?(s="b",a.bottom=a.midLat,a.right=a.midLon):i<a.midLat&&n<a.midLon?(s="c",a.top=a.midLat,a.right=a.midLon):(s="d",a.top=a.midLat,a.left=a.midLon),c+=s,!(u=u[s]))return h(f);if(u.pos>=0&&u.len){var E=e.get(c);E||(E=p(r,u.pos,u.len),e.set(c,E));for(var m=[],z=0;z<E.features.length;z++)l.default(d,E.features[z])&&m.push(E.features[z].properties.tzid);return m.length>0?m:h(f)}if(u.length>0)return u.map(function(e){return t.timezones[e]});if("object"!=typeof u)throw new Error("Unexpected data type");a.midLat=(a.top+a.bottom)/2,a.midLon=(a.left+a.right)/2}}(m,s,z,t,e)},exports.preCache=function(){T({preload:!0})},exports.setCache=T; | ||
//# sourceMappingURL=find-now.js.map |
{ | ||
"name": "geo-tz", | ||
"version": "8.0.2", | ||
"version": "8.1.0", | ||
"description": "A node.js module to find the timezone at specific gps coordinates", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -103,9 +103,13 @@ # node-geo-tz | ||
This library relies on reading a large data file from disk to perform exact geographic lookups. Therefore, it is not intended to be used in the browser and may have issues with bundlers if they don't include the necessary file. | ||
This library relies on reading a large data file from disk to perform exact geographic lookups. Therefore, it is not intended to be used in the browser and may have issues with bundlers (see below). | ||
### Bundlers | ||
Because this library reads the [`data/`](/data/) directory from disk at runtime, it would typically not be included by standard bundling tools and needs to be copied somewhere explicitly after bundling your JavaScript code. Once you have a location for the `data/` directory after bundling, the `GEO_TZ_DATA_PATH` environment variable can be set for this library to read from that directory. | ||
### Accuracy of Output | ||
The underlying data is obtained from the [timezone-boudary-builder](https://github.com/evansiroky/timezone-boundary-builder) project. The data from that project is mostly sourced from OpenStreetMap which is editable by anyone. In most cases, the timezone boundaries follow officially observed boundaries, but often times some communities near timezone boundaries may follow whichever timekeeping method works best for them. | ||
The underlying data is obtained from the [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder) project. The data from that project is mostly sourced from OpenStreetMap which is editable by anyone. In most cases, the timezone boundaries follow officially observed boundaries, but often times some communities near timezone boundaries may follow whichever timekeeping method works best for them. | ||
The boundaries in the ocean come from the [timezone-boudary-builder](https://github.com/evansiroky/timezone-boundary-builder) project which only includes territorial waters and not exclusive economic zones. Additionally, special cases where the GPS coordinate falls with an area of [Terra nullius](https://en.wikipedia.org/wiki/Terra_nullius) will also have an ocean zone(s) returned. | ||
The boundaries in the ocean come from the [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder) project which only includes territorial waters and not exclusive economic zones. Additionally, special cases where the GPS coordinate falls with an area of [Terra nullius](https://en.wikipedia.org/wiki/Terra_nullius) will also have an ocean zone(s) returned. | ||
@@ -112,0 +116,0 @@ The resulting timezone identifiers will represent the timekeeping method as is cataloged to the best of the knowledge of the maintainers of the timezone database. This could be wrong in the past (especially prior to 1970) and could change in the future should an area change the way they keep track of time. |
@@ -6,9 +6,6 @@ import * as path from 'path' | ||
const DATA_PATH = | ||
process.env.GEO_TZ_DATA_PATH || path.join(__dirname, '..', 'data') | ||
const TZ_DATA = require('../data/timezones-1970.geojson.index.json') | ||
const FEATURE_FILE_PATH = path.join( | ||
__dirname, | ||
'..', | ||
'data', | ||
'timezones-1970.geojson.geo.dat', | ||
) | ||
const FEATURE_FILE_PATH = path.join(DATA_PATH, 'timezones-1970.geojson.geo.dat') | ||
let featureCache | ||
@@ -15,0 +12,0 @@ |
@@ -6,9 +6,6 @@ import * as path from 'path' | ||
const DATA_PATH = | ||
process.env.GEO_TZ_DATA_PATH || path.join(__dirname, '..', 'data') | ||
const TZ_DATA = require('../data/timezones.geojson.index.json') | ||
const FEATURE_FILE_PATH = path.join( | ||
__dirname, | ||
'..', | ||
'data', | ||
'timezones.geojson.geo.dat', | ||
) | ||
const FEATURE_FILE_PATH = path.join(DATA_PATH, 'timezones.geojson.geo.dat') | ||
let featureCache | ||
@@ -15,0 +12,0 @@ |
@@ -6,9 +6,6 @@ import * as path from 'path' | ||
const DATA_PATH = | ||
process.env.GEO_TZ_DATA_PATH || path.join(__dirname, '..', 'data') | ||
const TZ_DATA = require('../data/timezones-now.geojson.index.json') | ||
const FEATURE_FILE_PATH = path.join( | ||
__dirname, | ||
'..', | ||
'data', | ||
'timezones-now.geojson.geo.dat', | ||
) | ||
const FEATURE_FILE_PATH = path.join(DATA_PATH, 'timezones-now.geojson.geo.dat') | ||
let featureCache | ||
@@ -15,0 +12,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69484922
122
1123
6