mirror of https://github.com/node-red/node-red.git
Merge pull request #4900 from hardillb/allow-number-user-properties-mqtt
Allow msg.userProperties to have number valuespull/4904/head
commit
8988176c22
|
@ -158,9 +158,16 @@ module.exports = function(RED) {
|
|||
if(!keys || !keys.length) return null;
|
||||
keys.forEach(key => {
|
||||
let val = srcUserProperties[key];
|
||||
if(typeof val == "string") {
|
||||
if(typeof val === "string") {
|
||||
count++;
|
||||
_clone[key] = val;
|
||||
} else if (val !== undefined && val !== null) {
|
||||
try {
|
||||
_clone[key] = JSON.stringify(val)
|
||||
count++;
|
||||
} catch (err) {
|
||||
// Silently drop property
|
||||
}
|
||||
}
|
||||
});
|
||||
if(count) properties.userProperties = _clone;
|
||||
|
|
Loading…
Reference in New Issue