Skip to content

krawaller/callbag-with-previous

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published