@ryandur/sand
    Preparing search index...

    Function asyncResult

    • const successfulResult = asyncResult(Promise.resolve('some value')).map(value => value + ', another value');
      await successfulResult.orNull(); // produces: "some value, another value"
      const failureResult = asyncResult(Promise.reject('some failure')).or(reason => asyncFailure(reason + ', another failure'));
      await failureResult.orNull(); // produces: null
      await failureResult.orElse('Not this'); // produces: "Not this"

      Type Parameters

      • S
      • F

      Parameters

      • promise: Promise<S>

      Returns Result.Async<S, F>