Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
9 years ago

Empty object with exists property

When the Find and FindChild methods do not find a match they return an empty object that just has the 'exists' property rather than returning 'nothing'.

I want my function to return a similar object so that I don't have to test for both conditions "is nothing" and "object.exists".

The only way that I can see to do this is to create a dummy call to one of these functions, that I know will fail, which is a bit ugly.

How do I create an empty object with just the 'exists' property?