1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Allow lat and lon to be 0 (#863)

Thanks
This commit is contained in:
Olivier Girondel 2021-11-29 22:16:06 +01:00 committed by GitHub
parent d4faa55ab8
commit 121da5deae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ module.exports = function(RED) {
var len = parseInt(value.precision || 9);
if (len < 1) { len = 1; }
if (len > 9) { len = 9; }
if (lat && lon) {
if (typeof lat === 'number' && typeof lon === 'number') {
value.geohash = geohash.encode(lat, lon, len);
RED.util.setMessageProperty(msg,node.property,value);
node.send(msg);