dominictarr / curry

simple curry module, with nothing *too clever*, and full test coverage
312 stars 19 forks source link

compose #23

Closed Altreus closed 9 years ago

Altreus commented 9 years ago

Any chance of adding a super-useful compose to this, since currying and composition are related, and it's handier than having to include a second module all the time?

Disclaimer: I got this from the internet - I've been using this in the browser and I don't have much experience with node to know whether adding it to the prototype is a good idea or not.

Function.prototype.compose  = function(argFunction) {
    var invokingFunction = this;
    return function() {
        return  invokingFunction.call(this,argFunction.apply(this,arguments));
    }
}
benjycui commented 9 years ago

If you need both curry and compose, you can try Ramda. Because curry is just a "simple curry module", instead of a swiss army knife.

Altreus commented 9 years ago

Thanks, I didn't know about this.

I'll add it to my toolchain. Request withdrawn :)