const successfulResult = await asyncResult(Promise.resolve('some value')).map(value => value + ', another value');successfulResult.orNull(); // produces: "some value, another value"successfulResult.failureOrElse('definitely this'); // produces: "definitely this" Copy
const successfulResult = await asyncResult(Promise.resolve('some value')).map(value => value + ', another value');successfulResult.orNull(); // produces: "some value, another value"successfulResult.failureOrElse('definitely this'); // produces: "definitely this"
const failureResult = await asyncResult(Promise.reject('some failure')).mapErr(value => value + ', another failure');failureResult.orNull(); // produces: nullfailureResult.failureOrElse('Not this'); // produces: "some failure, another failure" Copy
const failureResult = await asyncResult(Promise.reject('some failure')).mapErr(value => value + ', another failure');failureResult.orNull(); // produces: nullfailureResult.failureOrElse('Not this'); // produces: "some failure, another failure"