callbag-with-previous

1.1.0 • Public • Published

callbag-with-previous

Callbag operator that puts the previous value alongside the current in an array.

[currentValue, previousValue]

The first output will also have true as a third item, to allow you to distinguish from the previous item being undefined and the first value.

[firstValue, undefined, true]

npm install callbag-with-previous

example

const fromIter = require('callbag-from-iter');
const forEach = require('callbag-for-each');
const withPrevious = require('callbag-with-previous');

const source = withPrevious(fromIter([1,2,3]));

forEach(x => console.log(x))(source); // [1, undefined, true]
                                      // [2, 1]
                                      // [3, 2]

Readme

Keywords

Package Sidebar

Install

npm i callbag-with-previous

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

4.29 kB

Total Files

6

Last publish

Collaborators

  • krawaller