Transforms failure values in a Future without touching its state.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Transforms failure values in a Future without touching its state.
const { of, rejected } = require('folktale/concurrency/future');
of(1).mapRejected(x => x + 1).listen({
onResolved: (x) => $ASSERT(x == 1)
});
rejected(1).mapRejected(x => x + 1).listen({
onRejected: (x) => $ASSERT(x == 2)
});
mapRejected(transformation) {
return this.bimap(transformation, x => x);
}