Skip to content

Commit

Permalink
fix(dispose): support drivers that don't return streams
Browse files Browse the repository at this point in the history
Add check it output of a driver has .until()
  • Loading branch information
TylorS committed Dec 19, 2015
1 parent 0a8f718 commit 786adb2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ const makeSinkProxies = drivers =>
const callDrivers = (drivers, sinkProxies, disposableStream) =>
Object.keys(drivers)
.reduce((sources, driverName) => {
sources[driverName] =
const source =
drivers[driverName](hold(sinkProxies[driverName].stream), driverName)
.until(disposableStream)

sources[driverName] = typeof source.until === `function` ?
source.until(disposableStream) :
source

return sources
}, {})

Expand Down

0 comments on commit 786adb2

Please # to comment.