Checking object instance

Hi folks,

I'm finalizing a pull request for the node-red-contrib-image-output node, but I'm stuck ...

In another node (node-red-contrib-image-tools) the following code checks whether the input is a Jimp image object:

var Jimp = require('jimp');
...
if (data instanceof Jimp) {
   ...
}

And that code seems to be working fine, because the data instanceof Jimp condition is true:

image

Based on that node, I use identical code in my pull-request.
But when a Jimp image object enters my node:

image

Then the same condition image instanceof Jimp now results in false:

image

Have been looking over-and-over to my code, but cannot see the difference :woozy_face:

Does anybody see what I am doing wrong?

Thanks !!!
Bart

Couldn't get it working, but I was curious how the Chrome debugger knows (in the above screenshots) that it is a Jimp object, to display "Jimp" in the watch popup...

When I replace image instanceof Jimp by the following code snippet, then it works fine=:

image

But I still can't explain why I cannot use instanceof...

If nobody has horror stories about this workaround, I will use this workaround in my pull request ...