saferec

0.0.2 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i saferec

Weekly Downloads

0

Version

0.0.2

License

Unlicense

Unpacked Size

49.1 kB

Total Files

7

Last publish

Collaborators

  • micheleriva