callbag-map
Transform the source data and pipe it.
original idea by André Staltz - callbag
run test
$ yarn
$ yarn -s test
the status code ($?
) will be 0 or 1 depending on the result.
install
$ yarn add @gedalos.dev/callbag-map
using from nodejs
import pipe from '@gedalos.dev/callbag-pipe';
import of from '@gedalos.dev/callbag-of';
import map from '@gedalos.dev/callbag-map';
import forEach from '@gedalos.dev/callbag-for-each';
pipe(
of(1, 2, 3, 5, 8, 13, 21),
map((data) => data * 2),
forEach(console.log) // 2, 4, 6, 10, 16, 26, 42
);
using from browser
import pipe from 'callbag-pipe/index.js';
import of from 'callbag-of/index.js';
import map from 'callbag-map/index.js';
import forEach from 'callbag-for-each/index.js';
pipe(
of(1, 2, 3, 5, 8, 13, 21),
map((data) => data * 2),
forEach(console.log) // 2, 4, 6, 10, 16, 26, 42
);