UNPKG

kefir

Version:

Reactive Programming library for JavaScript inspired by Bacon.js and RxJS with focus on high performance and low memory usage

20 lines (17 loc) 410 B
import stream from './stream' export default function fromNodeCallback(callbackConsumer) { let called = false return stream(function(emitter) { if (!called) { callbackConsumer(function(error, x) { if (error) { emitter.error(error) } else { emitter.emit(x) } emitter.end() }) called = true } }).setName('fromNodeCallback') }