# Checking object instance

**URL:** <https://discourse.nodered.org/t/checking-object-instance/19482>\
**Category:** Developing Nodes\
**Created:** [22 December 2019 22:11 UTC](https://discourse.nodered.org/t/checking-object-instance/19482 "2019-12-22T22:11:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [22 December 2019 22:11 UTC](https://discourse.nodered.org/t/checking-object-instance/19482/1 "2019-12-22T22:11:03Z")

</div>

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](https://github.com/Steve-Mcl/node-red-contrib-image-tools/blob/master/imageViewer.js#L69) checks whether the input is a **Jimp image object** :

```auto
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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/08a0190bdeb76fb996f3485a6a1374cd0ad5d4a3.png)

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1d61b627dfd5c0b7564a8ba6c41d132da3862b9c.png)

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d511fee6050033b437d03e611a8520e52d5e1184.png)

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

Does anybody see what I am doing wrong?

Thanks !!!  
Bart

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [23 December 2019 09:29 UTC](https://discourse.nodered.org/t/checking-object-instance/19482/2 "2019-12-23T09:29:51Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/be13e35abb66b39159296335136f8e9fa011d7b1.png)

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 ...
