Implement isEmpty(value) — return true when a value holds no contents, false otherwise. This mirrors lodash's isEmpty: it answers "does this collection have anything in it?" across every kind of value JavaScript hands you — arrays, strings, plain objects, Maps, Sets, array-likes such as the arguments object, and primitives. The catch is that "empty" means different things for different types, and primitives have a rule that surprises people the first time they hit it.
// value: any JavaScript value
// returns: boolean — true if the value is considered empty
function isEmpty(value): boolean;
// Nullish, empty string, empty collections → true
isEmpty(null); // → true
isEmpty(undefined); // → true
isEmpty(''); // → true
isEmpty([]); // → true
isEmpty({}); // → true
isEmpty(new Map()); // → true
isEmpty(new Set()); // → true
// Anything with at least one entry → false
isEmpty('hi'); // → false
isEmpty([1, 2]); // → false
isEmpty({ a: 1 }); // → false
isEmpty(new Map([['a', 1]])); // → false
isEmpty(new Set([1])); // → false
// Primitives have no enumerable own properties, so they count as empty.
isEmpty(42); // → true
isEmpty(0); // → true
isEmpty(true); // → true
isEmpty(false); // → true
isEmpty treats it as empty and returns true. This matches lodash. isEmpty(0), isEmpty(42), isEmpty(NaN), and isEmpty(true) are all true. Don't special-case them as "not a collection and therefore false"; the rule is the opposite.Map and Set use .size, not .length. They have no .length property — reading it gives undefined. Emptiness is value.size === 0..length. '' and [] are empty; 'a' and [0] are not.length. The arguments object and any { length: n } shape are empty when length === 0.WeakMap/WeakSet (they expose no size), typed arrays, or the difference between own and inherited symbol keys — those are out of scope here.