mapRejected

Transforms failure values in a Future without touching its state.

Signature

value(transformation)
(Future 'f 's).(('f) => 'f2) => Future 'f2 's

Documentation

Transforms failure values in a Future without touching its state.

Example:

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)
});

Properties

Source Code

Defined in source/concurrency/future/_future.js at line 24, column 0
mapRejected(transformation) {
    return this.bimap(transformation, x => x);
  }
Stability
stable
Licence
MIT
Module
folktale/concurrency/future/_future
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)