Easy curry. Just what you need.

Usage no npm install needed!

<script type="module">
  import easyCurry from 'https://cdn.skypack.dev/easy-curry';


Easy curry. Just what you need.

dependencies minzipped size tested with jest

Only small and simple curry functions. Nothing more.


If you don't know what currying is or what it's youseful for, you can read a quick guide here: https://medium.com/@ivankorolenko/how-to-quickly-understand-currying-in-javascript-7a3875f3fde6

Why easy-curry?

✔️ Only what you need

✔️ No dependencies

✔️ Modular

✔️ Tree-shakable

✔️ Small size: 275 bytes minified and gzipped

✔️ Thoroughly covered with tests

✔️ Any number of arguments at a time

✔️ Partial application

✔️ Variadic functions currying

✔️ Easy to read code. You can understand what you're using

✔️ Install any way you like: NPM, CDN, manual import

Getting Started


Add this library to your project using NPM

npm i easy-curry

import what you need

import {curry} from 'easy-curry'

and use it

const add = (a, b) => a + b


Add this code to your HTML

<script src="https://cdn.jsdelivr.net/npm/easy-curry/curry.min.js"></script>

and use it

    const add = (a, b) => a + b


Download curry.min.js from this repository to your project's folder and use it

<script src="curry.min.js"></script>
    const add = (a, b) => a + b

How to use

You can import any function you need separately.

import {curry, curryN, curryV} from 'easy-curry'

This library has no default export. Why it's a good thing

curry - classical currying. Creates a sequence of functions that corresponds to passed function's arity

curryN - curryies a function to fixed arity

curryV - variadic currying. Enhanced version of classical currying. Curried function supports termination (early value return), meaning it can be called before receiving the full set of arguments using empty argument call.

Examples of usage:

  • curry(someFunction(1)(2)(3))
  • curry(someFunction(1, 2, 3))
  • curry(someFunction(1, 2)(3))
  • curry(someFunction(1)(2))
  • curryN(1, someFunction(1))
  • curryV(someFunction(1)(2)())