eugeneware/unique-stream — pull request #7 by craigambrose (2014-12-28 09:19:53+00:00)
Title: Refactored to use through2-filter and then allowed key store to be passed in

Hi Eugene, I wanted a version of unique-stream which wouldn't lose it's store of keys if I restarted node, so I've modified you library to take in keyStore as an optional parameter. In order to give it a nice interface, I'm asking for any object with has(key) and and(key) methods, and for the default store I'm using the es6-set library. Alternatively, in the example in the readme and in my additional test I provide an example of using your original object based store.

While doing this, I also thought the code might be simpler if I used through2-stream to handle all the complex stream stuff. That was a fairly major refactoring, but your tests all still pass, and it's greatly reduced the length of the code, and I think better exposes the intent, because it leaves the important bit (filtering objects based on whether the key has been seen before) and hides all the stream stuff.

I'd be keen to know whether you'd be interested in merging this in. I haven't bumped the version number as yet. This change should be fully backward compatible, but to be honest I can't say with full certainty that through2-filter doesn't have some quirks in areas that aren't covered by your tests.