Azure / azure-iot-hub-node

Azure IoT Hub Data Plane Node SDK
MIT License
2 stars 8 forks source link

check message type using instanceof #50

Closed sam-baumann closed 3 months ago

sam-baumann commented 3 months ago

In 'Client.send', message type is checked using message.constructor.name !== 'Message'.

If your code is bundled/minified, the constructor of the Message class may no longer be named 'message', so it is better to check it using instanceof, which would still work with minified code.

sam-baumann commented 3 months ago

realized this will not work because the 'Message' type a user passes in (that they've imported from azure-iot-common) does not match with the 'Message' type this file imports from dist/common-core. Will think about workarounds