Library API
    Preparing search index...

    Function nullishToValue

    • Returns the value if defined, otherwise the fallback value.

      Type Parameters

      • T
      • R

      Parameters

      • obj: T

        The value to check

      • value: R

        The fallback value

      Returns R | NonNullable<T>

      The original value or the fallback value

      const val = nullishToValue(null, 'default'); // 'default'