Your Question is answered in the docs you linked.
If the functions are called on objects, they check the length. If length > 0, the object is not considered empty.
const a = {
b: undefined,
c: undefined
};
console.log(Object.keys(a).length); // 2
Underscore Docs
Returns true if an enumerable object contains no values (no enumerable own-properties). For strings and array-like objects _.isEmpty checks if the length property is 0.
Lodash Docs
Checks if value is an empty object, collection, map, or set.
Objects are considered empty if they have no own enumerable string keyed properties.
Array-like values such as arguments objects, arrays, buffers, strings, or jQuery-like collections are considered empty if they have a length of 0. Similarly, maps and sets are considered empty if they have a size of 0.
For that, imagine a file cabinet representing your object. While there may be nothing contained by the drawers, physically, the cabinet still contains the three drawers themselves. Depending on the context in which you use _.isEmpty()
, this might or might not be an important piece of information.
