help-curry
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

help-curry

Small js package I use to quickly curry functions

XO code style GitHub workflow status npm bundle size npm downloads

Install

$ npm install pkg-name

Import

This package is pure ESM. It cannot be require()'d from CommonJS.

Use import foo from 'foo' instead of const foo = require('foo') to import the package.

// Load entire build
import curry from 'help-curry';

If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).

You also need to make sure you're on the latest minor version of Node.js. At minimum Node.js 12.20, 14.14, or 16.0.

Read more here: sindresorhus/esm-package

Usage

function sum(a, b, c) {
  return a + b + c;
}

let curriedSum = curry(sum);

curriedSum(1, 2, 3);
//=> 6, still callable normally

curriedSum(1)(2,3)
//=> 6, currying of 1st arg

curriedSum(1)(2)(3)
//=> 6, full currying

License

MIT © Paul Nodet

Package Sidebar

Install

npm i help-curry

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

4.46 kB

Total Files

5

Last publish

Collaborators

  • pnodet