DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on

Check if an object is empty

Alt Text

Top comments (5)

Collapse
 
pentacular profile image
pentacular

When would you ever want to test for this?

Collapse
 
ml318097 profile image
Mehul Lakhanpal

I don't know. Depends on the situation.

Collapse
 
pentacular profile image
pentacular

Can you think of a situation where it would be the reasonable thing to do? :)

Collapse
 
sumukhesh profile image
Sumukhesh

One situation i can think of is to use this a validation for data in forms.

Thread Thread
 
pentacular profile image
pentacular

l don't think that makes sense.

When validating you would want to check the requirements for that form, not that it was an empty object.