Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/gianlucaguarini/curri

Minimal curry implementation
https://github.com/gianlucaguarini/curri

Last synced: 2 days ago
JSON representation

Minimal curry implementation

Awesome Lists containing this project

README

        

# curri

curri.js

> `curri` in some Italian :it: dialects means `run`

[![Build Status][ci-image]][ci-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
```

[ci-image]: https://img.shields.io/github/actions/workflow/status/gianlucaguarini/curri/test.yml?style=flat-square
[ci-url]: https://github.com/gianlucaguarini/curri/actions

[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

### 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