dead-simple-curry

1.1.2 • Public • Published

dead simple curry Build Status

Probably the simplest currying ever :)

Installation

npm i dead-simple-curry --save

Usage

Yes! It's dead simple.

const curry = require('dead-simple-curry');
 
function multiply(a, b) {
  return a * b;
}
 
const doubleMe = curry(multiply)(2);
 
doubleMe(3) → 6
doubleMe(7) → 14
// ...

Some more useful examples:

import curry from 'dead-simple-curry';
 
function sendEvent(category, action, label) {
    ga('send', category, action, label);
}
 
const sendVideoEvent = curry(sendEvent)('video');
sendVideoEvent('play', 'funny cats');
 
const playEvent = sendVideoEvent('play');
playEvent('funny cats');
 

Don't forget to take a look at the specification.

Credits

Currying vs Partial Application by Dave Atchley.

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i dead-simple-curry

    Weekly Downloads

    2

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • michal.jezierski