grncdr / merge-stream

Merge multiple streams into one interleaved stream
MIT License
214 stars 16 forks source link

Expose `sources` directly instead of a `isEmpty` method? #21

Closed stevemao closed 9 years ago

stevemao commented 9 years ago

This way you can actually get the list of sources and makes it more flexible.

shinnn commented 9 years ago

+1

I didn't realize that this module has the isEmpty method since it's not documented.

stevemao commented 9 years ago

It needs to be immutable though.

grncdr commented 9 years ago

It needs to be immutable though.

:+1:

TBH though, "makes it more flexible" isn't a great reason for a feature IMO. Can we have some concrete use cases?

stevemao commented 9 years ago

similar reason to why we need isEmpty. I just want to extend this so you can see "how many" and "what are they" but don't want them to be changed.

grncdr commented 9 years ago

Sure, but it's not a concrete use case. I'm looking for something more like: I have this problem to solve, and merge-stream almost works, but it would be very helpful if I could get a reference to all of the input streams.

Taking isEmpty as an example, the problem was that an empty merge stream would never emit end, and if you couldn't see that a stream was empty before calling pipe, it was very difficult to understand why your program never finished. I'd expect we can find a similar motivating use case for exposing sources, but I don't know what it is yet.

stevemao commented 9 years ago

Thanks @grncdr , it makes sense. @shinnn maybe we should just add isEmpty to the doc and do 1.0.0 release?

grncdr commented 9 years ago

Thanks @grncdr , it makes sense. @shinnn maybe we should just add isEmpty to the doc and do 1.0.0 release?

I like this idea. Releasing 1.0.0 now means consumers can add ^1.0.0 to their dependencies and get this enhancement in the future.

grncdr commented 9 years ago

:+1:

stevemao commented 9 years ago

Let's make a release if you guys are happy :)

shinnn commented 9 years ago

e973cf43ef0edda5d4e3b08b07040d4039822734