curry-d
Version:
Curry and curry right at arbitrary depth, then uncurry, if you want.
6 lines • 733 B
JavaScript
/**
* @license
* curry-d 0.5.0
* Build time: 2013-07-13P23:07:30
*/
;!function(a,b){"function"==typeof define&&define.amd?define(["exports"],b):"object"==typeof exports?b(exports):b(a)}(this,function(a){"use strict";var b=Array.prototype.slice,c="right",d=function(a){var d=a===c;return function e(a,c,f,g,h){c=c?c:a.length,f=!!f,g=g!==!1,h=h||[];var i=h.length,j=function(j){var k=i,l=h.slice();f?l[i++]=j:l=l.concat(b.call(arguments));var m=null,n=l.length;return c>n?(m=e(a,c,f,g,l),m.len=c-n,i=k,m):g?d?(l.reverse().splice(0,n-c),a.apply(this,l)):a.apply(this,l.slice(0,c)):a.apply(this,d?l.reverse():l)};return j._fn=a,j.len=c,j}};a.curry=d(),a.curryRight=a.curry.r=d(c),a.uncurry=a.curry.un=function(a){return a._fn||a}});