Transforms the successful value of 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 the successful value of a Future, without touching its state.
const { of, rejected } = require('folktale/concurrency/future');
of(1).map(x => x + 1).listen({
onResolved: (value) => $ASSERT(value == 2)
});
rejected(1).map(x => x + 1).listen({
onRejected: (value) => $ASSERT(value == 1)
});
map(transformation) {
return this.chain(value => Future.of(transformation(value)));
}