JS: Check if object is a MapObject

How do I check if an object is a MapObject in JS?
I tried doing object instanceof MapObject but it gave me a TypeError.

I need this because I’m making a map format for my game, and I’m (trying to) pass object properties by ID.

I don’t think you can, except by testing for the presense of some property that only a MapObject will have, e.g. className (which will be empty for a MapObject with no class, but will be defined).

What do you mean by “pass object properties by ID”? Perhaps there’s a better solution for what you’re doing.

I mean object references in custom properties. (They show up as arrows in the editor)

Ah. So you’re looking to tell if a custom property has given you a MapObject or an ObjectRef or something else? If you can’t assume such things then yeah, I think checking if it has a className might be your best bet.