Tweakr
    Preparing search index...

    Function isEmpty

    • Checks if a value is "empty".

      This function considers the following as empty:

      • null or undefined
      • Strings or arrays with length === 0
      • Map or Set with size === 0
      • Plain objects with no own enumerable properties

      Numbers, booleans, functions, and other non-collection types are considered not empty.

      Parameters

      • value: unknown

        The value to check for emptiness.

      Returns boolean

      true if the value is considered empty, false otherwise.

      1.1.0

      isEmpty(null);          // true
      isEmpty([]); // true
      isEmpty(""); // true
      isEmpty({}); // true
      isEmpty(new Map()); // true
      isEmpty([1, 2, 3]); // false
      isEmpty({ a: 1 }); // false