# thunk

> A generator for trampoline-evaluated recursive algorithms

Latest version **0.0.1** (published 2012-06-23) · 0 weekly downloads

## Install

```sh
npm install thunk
pnpm add thunk
yarn add thunk
bun add thunk
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2012-06-23 |
| First published | 2012-06-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jay Adkisson |
| Maintainers | jayferd |

## Links

- npm: https://www.npmjs.com/package/thunk
- Repository: https://github.com/jayferd/thunk.js
- npm.io page: https://npm.io/package/thunk

## Dependencies (1)

- [pjs](https://npm.io/package/pjs.md) *

## Recent versions

- 0.0.1 (latest) — 2012-06-23

## README

# Thunk

Usage:

``` js
var thunk = require('thunk');

var factorial = thunk.makeTrampoline(function(recurse) {
  return function(cc, n) {
    if (n <= 1) return cc(1);

    return recurse(function(result) { return cc(n * result) }, n - 1);
  };
});

factorial(5) // 120, with a constant stack size.  Aww, yiss.
```

---
_Source: https://npm.io/package/thunk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
