@chickenjdk/byteutils
    Preparing search index...

    Function knownPromiseThen

    • A shortcut function to help with processing values that may or may not be promises but you know which

      Type Parameters

      • IsAsync extends boolean
      • returnType
      • cbReturnType

      Parameters

      • maybePromise: MaybePromise<returnType, IsAsync>

        The value that may or may not be a promise

      • callback: (value: returnType) => cbReturnType

        The callback to call with the value returned when the promise is resolved or when the value is returned directly.

      • async: IsAsync

        If the function is async

      Returns MaybePromise<cbReturnType, IsAsync>

      If async is true it will run maybePromise.then(callback), otherwise it will run callback(maybePromise). If your async param is wrong, the behavior is not guaranteed and may change inside major versions