Transforms failure values in a Future without touching its state.
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);
}