Function ifNotExistsThenWithReturn

Executes a callback if the value does not exist and returns the result

  • Type Parameters

    • T

      The type of the value

    Parameters

    • callback: (() => T)

      The callback function to execute that returns a value

        • (): T
        • Returns T

    • Optionalvalue: T

      The value to check (optional)

    Returns T

    The result of the callback if value doesn't exist, otherwise the original value