Skip to content
Dan Stocker edited this page Jun 1, 2019 · 2 revisions

Usage: createMapper<I, O>(cb: (value: I, tag?: Tag) => O)

Module: flowcode-fp

Type: Mapper<I, O>

Input ports:

  • d_val: I

Output ports:

  • b_d_val: O
  • d_val: O
  • ev_err: string

Maps input value according to mapper callback. Bounces input, and emits stringified error when callback throws.

import {connect} from "flowcode";
import {createMapper} from "flowcode-fp";
const mapper = createMapper(next => 2 * next);
connect(mapper.o.d_val, console.log);
mapper.i.d_val(5); // logs: 10

Clone this wiki locally