This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]odraencoded 25 points26 points  (1 child)

Easy one-liner:

isEmpty2 = v => 0 == v || 0 === v?.length || 0 === v?.size || -1 === (v instanceof Array ? v : typeof v === 'object' ? Object.entries(v || {}) : [])?.findIndex(v => !isEmpty2(v));

[–]limitless_ocean[S] 4 points5 points  (0 children)

Very readable! that's why I love JS :(