53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# curri
|
|
|
|
<img alt="curri.js" src="https://cdn.rawgit.com/GianlucaGuarini/curri/master/curri.gif" width="50%"/>
|
|
|
|
> `curri` in some Italian :it: dialects means `run`
|
|
|
|
[![Build Status][travis-image]][travis-url]
|
|
|
|
[![NPM version][npm-version-image]][npm-url]
|
|
[![NPM downloads][npm-downloads-image]][npm-url]
|
|
[![MIT License][license-image]][license-url]
|
|
|
|
## Usage
|
|
|
|
```js
|
|
import curry from 'curri'
|
|
|
|
const add = (a, b) => a + b
|
|
const add3 = curry(add)(3)
|
|
|
|
console.log(add3(5)) // 8
|
|
```
|
|
|
|
[travis-image]: https://img.shields.io/travis/GianlucaGuarini/curri.svg?style=flat-square
|
|
|
|
[travis-url]: https://travis-ci.org/GianlucaGuarini/curri
|
|
|
|
[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
|
|
|
|
[license-url]: LICENSE
|
|
|
|
[npm-version-image]: http://img.shields.io/npm/v/curri.svg?style=flat-square
|
|
|
|
[npm-downloads-image]: http://img.shields.io/npm/dm/curri.svg?style=flat-square
|
|
|
|
[npm-url]: https://npmjs.org/package/curri
|
|
|
|
## API
|
|
|
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
|
|
### curry
|
|
|
|
Function to curry any javascript method
|
|
|
|
**Parameters**
|
|
|
|
- `fn` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the target function we want to curry
|
|
- `acc` **...\[args]** initial arguments
|
|
|
|
Returns **([Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function) | any)** it will return a function until the target function
|
|
will receive all of its arguments
|