@nevware21/ts-utils

    Function isEmpty

    • Checks if a value is empty. Works with strings, arrays, objects, maps, and sets. Returns true for null or undefined.

      Parameters

      • value: any

        The value to check

      Returns boolean

      True if the value is empty or null/undefined

      isEmpty("");                    // true
      isEmpty([]); // true
      isEmpty({}); // true
      isEmpty(new Map()); // true
      isEmpty(new Set()); // true
      isEmpty(null); // true
      isEmpty(undefined); // true

      isEmpty("hello"); // false
      isEmpty([1, 2, 3]); // false
      isEmpty({ key: "value" }); // false
      isEmpty(new Map([["a", 1]])); // false
      isEmpty(new Set([1, 2])); // false
    MMNEPVFCICPMFPCPTTAAATR