Checks if a value is "empty".
This function considers the following as empty:
null
undefined
length === 0
Map
Set
size === 0
Numbers, booleans, functions, and other non-collection types are considered not empty.
The value to check for emptiness.
true if the value is considered empty, false otherwise.
true
false
1.1.0
isEmpty(null); // trueisEmpty([]); // trueisEmpty(""); // trueisEmpty({}); // trueisEmpty(new Map()); // trueisEmpty([1, 2, 3]); // falseisEmpty({ a: 1 }); // false Copy
isEmpty(null); // trueisEmpty([]); // trueisEmpty(""); // trueisEmpty({}); // trueisEmpty(new Map()); // trueisEmpty([1, 2, 3]); // falseisEmpty({ a: 1 }); // false
Checks if a value is "empty".
This function considers the following as empty:
null
orundefined
length === 0
Map
orSet
withsize === 0
Numbers, booleans, functions, and other non-collection types are considered not empty.