Re: [whatwg/streams] light weight transformations (#461)

@ariutta yes, you get the same sort of problem with many apis. Although streams are all bascially the same thing, there is still a lot of different ways to do them. So, what you want to build your parser to is the lowest common denominator, something that will be easy to wrap into any other interface. Node streams are not this. Node streams are _very heavy_. pull-streams are very light weight, but they target async - I'm not sure about rxjs or immutable-js. A parser is quite a simple case. so probably you can make something that can easily be wrapped to any of these interfaces.

Maybe just a thing that takes two functions `(data, end)` and can emit multiple items at each call and then end. data is called with each incoming data, and end is called once everything has finished. 
That maps to https://github.com/dominictarr/through https://github.com/rvagg/through2 https://github.com/rvagg/through2 https://github.com/pull-stream/pull-through

`flatMap` (i.e. map to an array, but then the array is expanded into the stream) is similar, but is limited because you may need to track a current state (say, an incomplete line or token). works great when the input is framed into "messages" though.


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/461#issuecomment-236398632

Received on Sunday, 31 July 2016 00:23:32 UTC