@chip/cstd - v0.0.8
    Preparing search index...

    Function isDefined

    • Type guard to check if a value is defined (not null or undefined). Returns a boolean indicating whether the value is defined with "is" for type narrowing.

      Type Parameters

      • T

        Describes the type of the value if the value is defined

      Parameters

      • value: T | null | undefined

        The value to check

      Returns value is T

      True if the value is defined (not null or undefined); otherwise, false

      // Return true
      isDefined(5); // true
      isDefined("hello"); // true

      // Return false
      isDefined(null); // false
      isDefined(undefined); // false