Help with how to get around this *problem* `msg.part`

For reasons unknown now I have this bit of code in a node:
newval = RED.util.getMessageProperty(msg,part)

I now see there is a problem if the msg.payload is simply true or false.

How can I detect this and avoid using the above line but rather just set newval to the message's payload?

Test it

newval = msg.paylod
if (msg.paylod && typeof msg.paylod === "object"){ 
    // msg.paylod is something and is definitely an object 
    newval = RED.util.getMessageProperty(msg,part)

?? or payload


Thanks @Steve-Mcl

That seems to be working.

I read around the typo.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.