👜 Callbag operator that samples a pullable when a listenable emits
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore initial commit Feb 4, 2018
LICENSE initial commit Feb 4, 2018
index.js swap signature Feb 13, 2018
package-lock.json initial commit Feb 4, 2018
package.json release 2.0.0 Feb 13, 2018
readme.md update readme Feb 13, 2018
test.js update tests Feb 13, 2018

readme.md

callbag-sample

Callbag operator that samples a value from the pullable source only when a listenable source emits, and returns a listenable source.

npm install callbag-sample

example

Sample the next character from a string, every second:

const fromIter = require('callbag-from-iter');
const interval = require('callbag-interval');
const forEach = require('callbag-for-each');
const sample = require('callbag-sample');

const source = sample(fromIter('hello'))(interval(1000));

forEach(x => console.log(x))(source); // h
                                      // e
                                      // l
                                      // l
                                      // o