Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/staltz/callbag-sample

👜 Callbag operator that samples a pullable when a listenable emits
https://github.com/staltz/callbag-sample

Last synced: 28 days ago
JSON representation

👜 Callbag operator that samples a pullable when a listenable emits

Awesome Lists containing this project

README

        

# 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:

```js
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
```