Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gunar/recur-fn

Recursive Arrow Functions for JavaScript
https://github.com/gunar/recur-fn

Last synced: 6 days ago
JSON representation

Recursive Arrow Functions for JavaScript

Awesome Lists containing this project

README

        

# Recursive Arrow Functions for JavaScript

## Installation

```
npm install recur-fn
```

## Usage

```js
const rec = require('recur-fn')

const factorial = rec((f,n) => (n>1 ? n*f(n-1) : n))

factorial(6) // 720
```

## Acknowledgement

Inspired by a [post on esdiscuss.org on recursive arrow functions](https://esdiscuss.org/topic/recursive-arrow-functions).

## License

MIT [http://gunar.mit-license.org]()