map

Transforms the successful value of a Future, without touching its state.

This feature is experimental!

This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.

Signature

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

Documentation

Transforms the successful value of a Future, without touching its state.

Example:

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

Properties

Source Code

Defined in source/concurrency/future/_future.js at line 24, column 0
map(transformation) {
    return this.chain(value => Future.of(transformation(value)));
  }
Stability
experimental
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/)