npm.io
1.3.0 • Published 7 years ago

callbag-from-promise

Licence
MIT
Version
1.3.0
Deps
1
Size
8 kB
Vulns
0
Weekly
0
Stars
5

callbag-from-promise

Convert a Promise to a callbag listenable source.

npm install callbag-from-promise

example

const fromPromise = require('callbag-from-promise');
const observe = require('callbag-observe');

const source = fromPromise(
  fetch('http://jsonplaceholder.typicode.com/users/1')
    .then(res => res.json())
);

observe(user => console.log(user.name))(source); // Leanne Graham

Keywords