0.0.2 • Published 5 years ago

saferec v0.0.2

Weekly downloads
1
License
Unlicense
Repository
-
Last release
5 years ago

SafeRec is a simple but powerful trampoline which converts your recursive function into a fast and safe while loop. You can read more about why you should adopt memory safe recursion here

Installation

Yarn

yarn add saferec

NPM

npm install saferec --save-dev

Usage

import rec from "saferec"

function factorial(num) {
  return num === 0
         ? 1
         : (num * factorial(num - 1));
}

const result = rec(factorial(1000));

LICENSE

The Unlicense