Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bounces

SimonRichardson6.9kMIT0.0.1

Trampoline

readme

Trampoline

Reifies continutations onto the heap, rather than the stack. Allows efficient tail calls.

Example usage:

function loop(n) {
   function inner(i) {
       if(i == n) return done(n);
       return cont(function() {
           return inner(i + 1);
       });
   }

   return trampoline(inner(0));
}

Where loop is the identity function for positive numbers. Without trampolining, this function would take n stack frames.