revert some changes for old nodejs versions

This commit is contained in:
Dave Conway-Jones 2021-09-24 17:11:59 +01:00
parent c94545d648
commit 3d337c75a6
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.16.0", "version": "2.16.1",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -16,12 +16,12 @@ module.exports = function(RED) {
function worldMap(node, n) { function worldMap(node, n) {
RED.nodes.createNode(node,n); RED.nodes.createNode(node,n);
node.lat = n.lat ?? ""; node.lat = n.lat || "";
node.lon = n.lon ?? ""; node.lon = n.lon || "";
node.zoom = n.zoom ?? ""; node.zoom = n.zoom || "";
node.layer = n.layer || ""; node.layer = n.layer || "";
node.cluster = n.cluster || ""; node.cluster = n.cluster || "";
node.maxage = n.maxage ?? ""; node.maxage = n.maxage || "";
node.showmenu = n.usermenu || "show"; node.showmenu = n.usermenu || "show";
node.layers = n.layers || "show"; node.layers = n.layers || "show";
node.panlock = n.panlock || "false"; node.panlock = n.panlock || "false";
@ -281,7 +281,7 @@ module.exports = function(RED) {
var bezierSpline = require("@turf/bezier-spline").default; var bezierSpline = require("@turf/bezier-spline").default;
var doTrack = function(msg) { var doTrack = function(msg) {
if (msg?.payload.hasOwnProperty("name")) { if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) {
var newmsg = RED.util.cloneMessage(msg); var newmsg = RED.util.cloneMessage(msg);
if (msg.payload.deleted) { if (msg.payload.deleted) {
if (msg.payload.name.substr(-1) === '_') { if (msg.payload.name.substr(-1) === '_') {
@ -360,7 +360,7 @@ module.exports = function(RED) {
node.send(newmsg); // send the track node.send(newmsg); // send the track
} }
} }
if (msg?.payload?.command.hasOwnProperty("clear")) { if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("command") && msg.payload.command.hasOwnProperty("clear")) {
for (var p in node.pointsarray) { for (var p in node.pointsarray) {
if (node.pointsarray.hasOwnProperty(p)) { if (node.pointsarray.hasOwnProperty(p)) {
if (node.pointsarray[p][0].layer === msg.payload.command.clear) { if (node.pointsarray[p][0].layer === msg.payload.command.clear) {
@ -428,7 +428,7 @@ module.exports = function(RED) {
} }
var doHull = function(msg) { var doHull = function(msg) {
if (msg?.payload.hasOwnProperty("name")) { if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) {
var newmsg = RED.util.cloneMessage(msg); var newmsg = RED.util.cloneMessage(msg);
newmsg.payload = {}; newmsg.payload = {};
newmsg.payload[node.prop] = msg.payload[node.prop] || "unknown"; newmsg.payload[node.prop] = msg.payload[node.prop] || "unknown";