Lodash isEmpty
Returns true for:
- All primitives BUT
string. - Objects with no "enumerable string-keyed properties"
- Arrays with a
lengthof0
Returns false for:
- Arrays or strings with a
lengthof>0 - Objects with any string-keyed properties
js
// true
_.isEmpty(true);
// false
_.isEmpty("hello");
// true
_.isEmpty(50);
// true
_.isEmpty(NaN);
// true
_.isEmpty(BigInt(50000000));