rvagg/abstract-leveldown — pull request #41 by bigeasy (2014-09-18 16:07:33+00:00)
Title: Implement `collectEntries` as trampoline.

In pure-JavaScript implementations that aggressively cache records certain test will blow the stack if `process.nextTick` is used. The warning issued suggests the use of `setImmediate` however, not all platforms may support `setImmediate`.

This implementation of `collectEntries` uses a trampoline so that invocations of `iterator.next` that do not result in an asynchronous call will not increase the depth of the stack. This eliminates recursion and prevents stack overflow.