From 3d337c75a6acdf6a6fe846a20c372939969286fe Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 24 Sep 2021 17:11:59 +0100 Subject: [PATCH] revert some changes for old nodejs versions --- package.json | 2 +- worldmap.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 9ddd8ed..ff0e253 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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.", "dependencies": { "cgi": "0.3.1", diff --git a/worldmap.js b/worldmap.js index ac3202f..768039e 100644 --- a/worldmap.js +++ b/worldmap.js @@ -16,12 +16,12 @@ module.exports = function(RED) { function worldMap(node, n) { RED.nodes.createNode(node,n); - node.lat = n.lat ?? ""; - node.lon = n.lon ?? ""; - node.zoom = n.zoom ?? ""; + node.lat = n.lat || ""; + node.lon = n.lon || ""; + node.zoom = n.zoom || ""; node.layer = n.layer || ""; node.cluster = n.cluster || ""; - node.maxage = n.maxage ?? ""; + node.maxage = n.maxage || ""; node.showmenu = n.usermenu || "show"; node.layers = n.layers || "show"; node.panlock = n.panlock || "false"; @@ -281,7 +281,7 @@ module.exports = function(RED) { var bezierSpline = require("@turf/bezier-spline").default; var doTrack = function(msg) { - if (msg?.payload.hasOwnProperty("name")) { + if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) { var newmsg = RED.util.cloneMessage(msg); if (msg.payload.deleted) { if (msg.payload.name.substr(-1) === '_') { @@ -360,7 +360,7 @@ module.exports = function(RED) { 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) { if (node.pointsarray.hasOwnProperty(p)) { if (node.pointsarray[p][0].layer === msg.payload.command.clear) { @@ -428,7 +428,7 @@ module.exports = function(RED) { } var doHull = function(msg) { - if (msg?.payload.hasOwnProperty("name")) { + if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) { var newmsg = RED.util.cloneMessage(msg); newmsg.payload = {}; newmsg.payload[node.prop] = msg.payload[node.prop] || "unknown";