brianc/node-pg-query-stream — pull request #5 by calvinmetcalf (2014-05-14 14:51:39+00:00)
Title: fix tests, clean up a few things

- the makefile referenced from the package.json isn't there so I switched it to just call mocha from the package.json (which deal with adding ./node_modules/.bin to the front
- I set the tests to each give their own name to the describe function instead of all being the same
- I removed lodash as that isn't use anywhere in the project
- switched it to use [readable-stream](https://github.com/isaacs/readable-stream) instead of the stream module so that older node environments will get the up to date streams
- removed the kickoff in the constructor as that is only needed in the weird edge case of listening for the end without listening for data
- related: added a listener for data to one of the tests so the data starts flowing
- switched a couple calls to setImmediate to process.next tick which is better performance wise (and also available in older node envs)
- switched a .bind to use a closure (In my experience, bind is super slow)
- added an early return to the _fetch callback so that it didn't set the reading state to false again so that there aren't more calls to _fetch while we are waiting to push null
- put the read/_fetch switch into the loop