@jiminp/tooltool
    Preparing search index...

    Function isNullish

    • Type guard that checks whether a value is nullish (null or undefined).

      Parameters

      • value: unknown

        The value to check

      Returns value is Nullish

      true if the value is null or undefined, false otherwise

      if (isNullish(user)) {
      console.log('User is not defined');
      }

      const values = [1, null, 2, undefined, 3];
      const defined = values.filter(v => !isNullish(v)); // [1, 2, 3]