ramda
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -1,2 +0,2 @@ | ||
// Ramda v0.10.0 | ||
// Ramda v0.11.0 | ||
// https://github.com/ramda/ramda | ||
@@ -6,2 +6,2 @@ // (c) 2013-2015 Scott Sauyet and Michael Hurley | ||
(function(){"use strict";var n={ramda:"placeholder"},t=function(n,t){return n+t},r=function(n,t){for(var r=-1;++r<t.length;)if(!n(t[r]))return!1;return!0},e=function(n,t){for(var r=-1;++r<t.length;)if(n(t[r]))return!0;return!1},u=function(n,t){return function(){return n.call(this,t.apply(this,arguments))}},i=function(n,t){n=n||[],t=t||[];var r,e=n.length,u=t.length,i=new Array(e+u);for(r=-1;++r<e;)i[r]=n[r];for(r=-1;++r<u;)i[e+r]=t[r];return i},o=function(n,t,r){for(var e=-1,u=r.length;++e<u;)if(n(t,r[e]))return!0;return!1},c=function(n){return function(t,r){if(r&&r.length>0){for(var e,u=0,i=r[u],o=t(i);++u<r.length;)e=t(r[u]),n(e,o)&&(o=e,i=r[u]);return i}}},a=function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)n(t[r])&&(u[u.length]=t[r]);return u},f=function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)n(t[r],r,t)&&(u[u.length]=t[r]);return u},l=function(n,t){for(var r=-1,e=t.length;++r<e;)n(t[r]);return t},s=function(n){return function(t){return a(function(n){return"function"==typeof t[n]},n(t))}},h=function(n,t){return n>t},g=function(n,t,r){var e=0,u=n.length;for("number"==typeof r&&(e=0>r?Math.max(0,u+r):r);u>e;){if(n[e]===t)return e;++e}return-1},p=Array.isArray||function(n){return null!=n&&n.length>=0&&"[object Array]"===Object.prototype.toString.call(n)},m=Number.isInteger||function(n){return n<<0===n},y=function(n){return null!=n&&n===Object(n)&&"function"==typeof n.then},v=function(n,t,r){var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},d=function(n,t){return t>n},w=function(n,t){for(var r=-1,e=t.length,u=new Array(e);++r<e;)u[r]=n(t[r]);return u},b=function(n,t){return n*t},O=function(){return new TypeError("Function called with no arguments")},j=function(n,t){return 0>n?t[t.length+n]:t[n]},x=function(n){return function(t){return w(function(n){return[n,t[n]]},n(t))}},A=function(n,t){var r,e=-1,u=n.length;if(null!=t){for(r=t;null!=r&&++e<u;)r=r[n[e]];return r}},I=function(n,t){var r={};return l(function(n){r[n]=t[n]},n),r},E=function(n,t){return i([n],t)},k=function(n,t,r){for(var e=-1,u=r.length;++e<u;)t=n(t,r[e]);return t},M=function(n,t,r){if(n===r)return!0;if(null==r)return!1;t.fn=t.fn||[],t.obj=t.obj||[];for(var e,u,i=-1,o=t.fn.length,c=-1,a=t.obj.length;++i<o;){if(e=t.fn[i],u=n[e],!(e in r))return!1;if(!u(r[e],r))return!1}for(;++c<a;)if(e=t.obj[c],n[e]!==r[e])return!1;return!0},P=function qu(n,t,r){switch(arguments.length){case 0:throw O();case 1:return qu(n,0,n.length);case 2:return qu(n,t,n.length);default:for(var e=Math.max(0,r-t),u=new Array(e),i=-1;++i<e;)u[i]=n[t+i];return u}},T=function(n){return function(){return n}},S=function(n,t){switch(n){case 0:return function(){return t.apply(this,arguments)};case 1:return function(n){return t.apply(this,arguments)};case 2:return function(n,r){return t.apply(this,arguments)};case 3:return function(n,r,e){return t.apply(this,arguments)};case 4:return function(n,r,e,u){return t.apply(this,arguments)};case 5:return function(n,r,e,u,i){return t.apply(this,arguments)};case 6:return function(n,r,e,u,i,o){return t.apply(this,arguments)};case 7:return function(n,r,e,u,i,o,c){return t.apply(this,arguments)};case 8:return function(n,r,e,u,i,o,c,a){return t.apply(this,arguments)};case 9:return function(n,r,e,u,i,o,c,a,f){return t.apply(this,arguments)};case 10:return function(n,r,e,u,i,o,c,a,f,l){return t.apply(this,arguments)};default:throw new Error("First argument to arity must be a non-negative integer no greater than ten")}},W=function(n){return n.apply(this,P(arguments,1))},N=function(n){return function(t,r){return n(t,r)?-1:n(r,t)?1:0}},R=function(){var n=arguments;return function(){for(var t=-1;++t<n.length;)if(n[t][0].apply(this,arguments))return n[t][1].apply(this,arguments)}},q=function(n){var t=P(arguments,1);return function(){var r=arguments;return n.apply(this,w(function(n){return n.apply(this,r)},t))}},C=function(n){return function(t,r){switch(arguments.length){case 0:throw O();case 1:return function(r){return n.apply(this,[r,t].concat(P(arguments,1)))};default:return n.apply(this,i([r,t],P(arguments,2)))}}},L=function(n){for(var t=-1,r=n.length,e={};++t<r;)p(n[t])&&n[t].length&&(e[n[t][0]]=n[t][1]);return e},B=function(n,t){switch(arguments.length){case 0:throw O();case 1:return function(t){return t[n].apply(t,P(arguments,1))};default:return t[n].apply(t,P(arguments,2))}},F=function(n){return n},z=function(n){return p(n)?!0:n?"object"!=typeof n?!1:n instanceof String?!1:1===n.nodeType?!!n.length:0===n.length?!0:n.length>0?n.hasOwnProperty(0)&&n.hasOwnProperty(n.length-1):!1:!1},D=function(n){return 0===Object(n).length},U=function(n){return null==n},_=function(n){for(var t=n.length,r=-1;++r<t;)if(g(n,n[r],r+1)>=0)return!1;return!0},$=function(n){var t,r=[];for(t in n)r[r.length]=t;return r},G=function(n,t){switch(n){case 0:return function(){return t.call(this)};case 1:return function(n){return t.call(this,n)};case 2:return function(n,r){return t.call(this,n,r)};case 3:return function(n,r,e){return t.call(this,n,r,e)};case 4:return function(n,r,e,u){return t.call(this,n,r,e,u)};case 5:return function(n,r,e,u,i){return t.call(this,n,r,e,u,i)};case 6:return function(n,r,e,u,i,o){return t.call(this,n,r,e,u,i,o)};case 7:return function(n,r,e,u,i,o,c){return t.call(this,n,r,e,u,i,o,c)};case 8:return function(n,r,e,u,i,o,c,a){return t.call(this,n,r,e,u,i,o,c,a)};case 9:return function(n,r,e,u,i,o,c,a,f){return t.call(this,n,r,e,u,i,o,c,a,f)};case 10:return function(n,r,e,u,i,o,c,a,f,l){return t.call(this,n,r,e,u,i,o,c,a,f,l)};default:throw new Error("First argument to nAry must be a non-negative integer no greater than ten")}},H=function(n){return function(){return!n.apply(this,arguments)}},J=function(n){return function(){return j(n,arguments)}},K=function(n){return[n]},Q=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments))}},V=C(E),X=function(n,t){switch(arguments.length){case 0:throw O();case 1:return function(t){return t[n]}}return t[n]},Y=C(X),Z=function(n){return P(n).reverse()},nt=x($),tt=function(){var n=" \n\f\r \u2028\u2029",t="",r="function"==typeof String.prototype.trim;return r&&!n.trim()&&t.trim()?function(n){return n.trim()}:function(t){var r=new RegExp("^["+n+"]["+n+"]*"),e=new RegExp("["+n+"]["+n+"]*$");return t.replace(r,"").replace(e,"")}}(),rt=function(n){return null===n?"Null":void 0===n?"Undefined":Object.prototype.toString.call(n).slice(8,-1)},et=function(n){if(0===arguments.length)throw O();return function(){return n(P(arguments))}},ut=function(n){return G(1,n)},it=function(n){var t,r=[];for(t in n)r[r.length]=n[t];return r},ot=T(!1),ct=F,at=T(!0),ft=function(n,t){return i(t,[n])},lt=function Cu(n,t,r){var e=function(e){for(var u=t.length,i=-1;++i<u;)if(n===t[i])return r[i];t[t.length]=n,r[r.length]=e;for(var o in n)e[o]=Cu(n[o],t,r);return e};switch(rt(n)){case"Object":return e({});case"Array":return e([]);case"Date":return new Date(n);default:return n}},st=function(n,t){return function(r,e,u){var i=arguments.length,o=arguments[i-1],c=o&&!p(o)&&"function"==typeof o[n];switch(arguments.length){case 0:return t();case 1:return c?o[n]():t(r);case 2:return c?o[n](r):t(r,e);case 3:return c?o[n](r,e):t(r,e,u)}}},ht=function(n,t){return function(){var r=this,e=t.apply(this,arguments);return y(e)?e.then(function(t){return n.call(r,t)}):n.call(this,e)}},gt=function(n,t){return g(t,n)>=0},pt=function(n){return function(){switch(arguments.length){case 0:throw O();case 1:return arguments[0];default:for(var t=arguments.length-1,r=arguments[t],e=r.length;t--;)r=n(arguments[t],r);return S(e,r)}}},mt=function(n,t){return function(r){if(0===arguments.length)throw O();for(var e,u=-1,i=t;++u<r.length;)e=+r[u],n(e,i)&&(i=e);return i}},yt=function(n){return function(t){var r=P(arguments,1);return S(Math.max(0,t.length-r.length),function(){return t.apply(this,n(r,arguments))})}},vt=function(n){return function(t,r){switch(arguments.length){case 0:throw O();case 1:return function(r){return n(t,r)};default:return n(t,r)}}},dt=function(n){return function(t,r,e){switch(arguments.length){case 0:throw O();case 1:return vt(function(r,e){return n(t,r,e)});case 2:return function(e){return n(t,r,e)};default:return n(t,r,e)}}},wt=function(n,t){return null!=t&&!p(t)&&"function"==typeof t[n]},bt=function(n){return function t(r){for(var e,u,i,o=[],c=-1,a=r.length;++c<a;)if(z(r[c]))for(e=n?t(r[c]):r[c],u=-1,i=e.length;++u<i;)o[o.length]=e[u];else o[o.length]=r[c];return o}},Ot=function(n,t){for(var r,e={},u=$(t),i=u.length,o=-1;++o<i;)r=u[o],n(t[r],r,t)&&(e[r]=t[r]);return e},jt=function(n,t){return w(X(n),t)},xt=vt(t),At=vt(r),It=vt(function(n,t){return function(){return n.apply(this,arguments)&&t.apply(this,arguments)}}),Et=vt(e),kt=vt(ft),Mt=C(ft),Pt=vt(function(n,t){return n.apply(this,t)}),Tt=function(n){return G(2,n)},St=vt(function(n,t){return function(){return n.apply(t,arguments)}}),Wt=function(n){return lt(n,[],[])},Nt=pt(u),Rt=pt(ht),qt=dt(o),Ct=vt(function(n,t){var r={};return r[n]=t,r}),Lt=vt(function(n,t){return function r(e){return S(Math.max(n-(e&&e.length||0),0),function(){if(0===arguments.length)throw O();var u=i(e,arguments);return u.length>=n?t.apply(this,u):r(u)})}([])}),Bt=xt(-1),Ft=vt(function(n,t){return null==t?n:t}),zt=vt(function(n,t){for(var r=[],e=-1,u=n.length;++e<u;)gt(n[e],t)||gt(n[e],r)||(r[r.length]=n[e]);return r}),Dt=dt(function(n,t,r){for(var e=[],u=-1,i=t.length,o=qt(n);++u<i;)o(t[u],r)||o(t[u],e)||(e[e.length]=t[u]);return e}),Ut=vt(function(n,t){return Ot(function(t,r){return r!==n},t)}),_t=vt(st("drop",function(n,t){return n<t.length?P(t,n):[]})),$t=vt(function(n,t){for(var r=-1,e=t.length;++r<e&&n(t[r]););return P(t,r)}),Gt=function(n){return wt("empty",n)?n.empty():[]},Ht=vt(function(n,t){return 0===n?1/n===1/t:n===t||n!==n&&t!==t}),Jt=dt(function(n,t,r){return t[n]===r[n]}),Kt=vt(st("filter",a)),Qt=vt(f),Vt=vt(function(n,t){for(var r=-1,e=t.length;++r<e;)if(n(t[r]))return t[r]}),Xt=vt(function(n,t){for(var r=-1,e=t.length;++r<e;)if(n(t[r]))return r;return-1}),Yt=vt(function(n,t){for(var r=t.length;r--;)if(n(t[r]))return t[r]}),Zt=vt(function(n,t){for(var r=t.length;r--;)if(n(t[r]))return r;return-1}),nr=bt(!0),tr=vt(l),rr=vt(function(n,t){for(var r=-1,e=t.length;++r<e;)n(t[r],r,t);return t}),er=s($),ur=X,ir=vt(function(n,t){return k(function(t,r){var e=n(r);return t[e]=ft(r,t[e]||(t[e]=[])),t},{},t)}),or=vt(function(n,t){return Object.prototype.hasOwnProperty.call(t,n)}),cr=vt(function(n,t){return n in t}),ar=dt(function(n,t,r){return function(){return n.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)}}),fr=xt(1),lr=vt(function(n,t){return g(t,n)}),sr=dt(function(n,t,r){return n=n<r.length&&n>=0?n:r.length,i(ft(t,P(r,0,n)),P(r,n))}),hr=dt(function(n,t,r){return n=n<r.length&&n>=0?n:r.length,i(i(P(r,0,n),t),P(r,n))}),gr=function(n,t){var r=P(arguments,2),e=n-r.length;return Lt(e+1,function(){var n=arguments[e],u=r.concat(P(arguments,0,e));return n[t].apply(n,u)})},pr=vt(function(n,t){return null!=t&&t.constructor===n||t instanceof n}),mr=gr(1,"join"),yr=function(){var n=!{toString:null}.propertyIsEnumerable("toString"),t=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];return function(r){if(Object(r)!==r)return[];if(Object.keys)return Object.keys(r);var e,u,i=[];for(e in r)or(e,r)&&(i[i.length]=e);if(n)for(u=t.length;u--;)e=t[u],or(e,r)&&!gt(e,i)&&(i[i.length]=e);return i}}(),vr=vt(function(n,t){return v(t,n)}),dr=function(n){return null!=n&&pr(Number,n.length)?n.length:0/0},wr=vt(function(n,t){var r=function(t){return n(t)};return r.set=vt(t),r.map=vt(function(r,e){return t(r(n(e)),e)}),r}),br=vt(st("map",w)),Or=dt(function(n,t,r){for(var e=-1,u=r.length,i=new Array(u),o=[t];++e<u;)o=n(o[0],r[e]),i[e]=o[1];return[o[0],i]}),jr=dt(function(n,t,r){for(var e=r.length,u=r.length,i=new Array(u),o=[t];e--;)o=n(o[0],r[e]),i[e]=o[1];return[o[0],i]}),xr=vt(function(n,t){for(var r=-1,e=t.length,u=new Array(e);++r<e;)u[r]=n(t[r],r,t);return u}),Ar=vt(function(n,t){return k(function(r,e){return r[e]=n(t[e]),r},{},yr(t))}),Ir=vt(function(n,t){return k(function(r,e){return r[e]=n(t[e],e,t),r},{},yr(t))}),Er=gr(1,"match"),kr=mt(h,-1/0),Mr=vt(c(h)),Pr=function(){var n=function(n){return n+"::"+Object.prototype.toString.call(n)},t=function(t){return t.length+":{"+w(n,t).join(",")+"}"};return function(n){var r={};return function(){var e=t(arguments);return or(e,r)||(r[e]=n.apply(this,arguments)),r[e]}}}(),Tr=mt(d,1/0),Sr=vt(c(d)),Wr=vt(b),Nr=Wr(-1),Rr=vt(j),qr=vt(function(n,t){return Ot(function(t,r){return!gt(r,n)},t)}),Cr=vt(function(n,t){return function(){return n.apply(this,arguments)||t.apply(this,arguments)}}),Lr=yt(i),Br=yt(C(i)),Fr=vt(function(n,t){return k(function(t,r){return t[n(r)?0:1].push(r),t},[[],[]],t)}),zr=dt(function(n,t,r){return A(n.split("."),r)===t}),Dr=dt(function(n,t,r){return A(t.split(n),r)}),Ur=vt(function(n,t){return Ot(function(t,r){return gt(r,n)},t)}),_r=vt(I),$r=vt(Ot),Gr=function(){return Nt.apply(this,Z(arguments))},Hr=function(){return Rt.apply(this,Z(arguments))},Jr=vt(jt),Kr=vt(E),Qr=dt(function(n,t,r){return r[n]===t}),Vr=dt(function(n,t,r){return or(t,r)?r[t]:n}),Xr=vt(function(n,t){for(var r=n.length,e=new Array(r),u=-1;++u<r;)e[u]=t[n[u]];return e}),Yr=vt(function(n,t){if(n>=t)return[];for(var r=0,e=new Array(Math.floor(t)-Math.ceil(n));t>n;)e[r++]=n++;return e}),Zr=dt(k),ne=dt(function(n,t,r){for(var e=-1,u=r.length;++e<u;)t=n(t,r[e],e,r);return t}),te=dt(function(n,t,r){for(var e=r.length;e--;)t=n(t,r[e]);return t}),re=dt(function(n,t,r){for(var e=r.length;e--;)t=n(t,r[e],e,r);return t}),ee=vt(function(n,t){return Kt(H(n),t)}),ue=vt(function(n,t){return f(H(n),t)}),ie=dt(function(n,t,r){return i(P(r,0,Math.min(n,r.length)),P(r,Math.min(r.length,n+t)))}),oe=dt(function(n,t,r){return r.replace(n,t)}),ce=dt(function(n,t,r){var e=0,u=r.length+1,i=new Array(u);for(i[e]=t;++e<u;)t=n(t,r[e-1]),i[e]=t;return i}),ae=gr(2,"slice"),fe=vt(function(n,t){return Wt(t).sort(n)}),le=vt(function(n,t){return P(t).sort(function(t,r){var e=n(t),u=n(r);return u>e?-1:e>u?1:0})}),se=gr(1,"split"),he=vt(function(n,t){return t.indexOf(n)}),ge=vt(function(n,t){return t.lastIndexOf(n)}),pe=gr(2,"substring"),me=C(pe)(void 0),ye=pe(0),ve=Zr(t,0),de=st("tail",function(n){return P(n,1)}),we=vt(st("take",function(n,t){return P(t,0,Math.min(n,t.length))})),be=vt(st("takeWhile",function(n,t){for(var r=-1,e=t.length;++r<e&&n(t[r]););return P(t,0,r)})),Oe=vt(function(n,t){return n(t),t}),je=vt(function(n,t){for(var r=new Array(Number(t)),e=r.length,u=-1;++u<e;)r[u]=n(u);return r}),xe=gr(0,"toLowerCase"),Ae=x(yr),Ie=gr(0,"toUpperCase"),Ee=vt(function(n,t){for(var r=n(t),e=[];r&&r.length;)e[e.length]=r[0],r=n(r[1]);return e}),ke=function(n){for(var t,r=-1,e=n.length,u=[];++r<e;)t=n[r],gt(t,u)||(u[u.length]=t);return u},Me=vt(function(n,t){for(var r,e=-1,u=t.length,i=[];++e<u;)r=t[e],o(n,r,i)||(i[i.length]=r);return i}),Pe=bt(!1),Te=function(n){for(var t=yr(n),r=t.length,e=new Array(r),u=-1;++u<r;)e[u]=n[t[u]];return e},Se=function(n,t){var r=ir(function(t){return"function"==typeof n[t]?"fn":"obj"},yr(n));switch(arguments.length){case 0:throw O();case 1:return function(t){return M(n,r,t)}}return M(n,r,t)},We=function(n,t){return Lt(n.length,function(){return t.apply(this,i([n],arguments))})},Ne=vt(function(n,t){for(var r,e=-1,u=n.length,i=t.length,o=[];++e<u;)for(r=-1;++r<i;)o[o.length]=[n[e],t[r]];return o}),Re=vt(function(n,t){for(var r=[],e=-1,u=Math.min(n.length,t.length);++e<u;)r[e]=[n[e],t[e]];return r}),qe=vt(function(n,t){for(var r=-1,e=n.length,u={};++r<e;)u[n[r]]=t[r];return u}),Ce=dt(function(n,t,r){for(var e=[],u=-1,i=Math.min(t.length,r.length);++u<i;)e[u]=n(t[u],r[u]);return e}),Le=function(n,t){return wt("ap",n)?n.ap(t):k(function(n,r){return i(n,w(r,t))},[],n)},Be=function Lu(n,t,r,e){var u=rt(n);if(u!==rt(t))return!1;if(Ht(n,t))return!0;if("RegExp"==u)return n.source===t.source&&n.global===t.global&&n.ignoreCase===t.ignoreCase&&n.multiline===t.multiline&&n.sticky===t.sticky&&n.unicode===t.unicode;if(Object(n)===n){if("Date"===u&&n.getTime()!=t.getTime())return!1;var i=yr(n);if(i.length!==yr(t).length)return!1;for(var o=r.length;o--;)if(r[o]===n)return e[o]===t;for(r.push(n),e.push(t),o=i.length;o--;){var c=i[o];if(!or(c,t)||!Lu(t[c],n[c],r,e))return!1}return r.pop(),e.pop(),!0}return!1},Fe=function(n,t){for(var r=yr(t),e=-1,u=r.length;++e<u;)n[r[e]]=t[r[e]];return n},ze=function(n){return function(t){var r=function(){var r=arguments;return n(function(n){return n.apply(null,r)},t)};return arguments.length>1?r.apply(null,P(arguments,1)):S(kr(jt("length",t)),r)}},De=ze(r),Ue=ze(e),_e=vt(Le),$e=dt(function(n,t,r){return Fe(L(w(function(n){return[n,r[n]]},$(r))),Ct(n,t))}),Ge=function(){var n=function(t,r,e){if(1===t.length)return $e(t[0],r,e);var u=e[t[0]];return $e(t[0],n(P(t,1),r,pr(Object,u)?u:{}),e)};return function(t,r,e){var u=arguments.length;if(0===u)throw O();var i=se(".",t),o=vt(function(t,r){return n(i,t,r)});switch(u){case 1:return o;case 2:return o(r);default:return o(r,e)}}}(),He=vt(st("chain",function(n,t){return Pe(w(n,t))})),Je=gr(1,"charAt"),Ke=gr(1,"charCodeAt"),Qe=dt(function(n,t,r){function e(t,r){return Le(w(kt,n(r)),t)}return k(e,t([]),r)}),Ve=vt(function(n,t){for(var r={},e=t.length,u=-1;++u<e;){var i=n(t[u]);r[i]=(or(i,r)?r[i]:0)+1}return r}),Xe=function(n){return Lt(n.length,n)},Ye=vt(function(n,t){return Be(n,t,[],[])}),Ze=vt(function(n,t){return Fe(Fe({},t),Ir(function(n,r){return n(t[r])},n))}),nu=s(yr),tu=Rr(0),ru=ae(0,-1),eu=function(n){return Fe(n,Ru)},uu=vt(function(n,t){return ke(a(C(gt)(n),t))}),iu=dt(function(n,t,r){for(var e=[],u=-1;++u<t.length;)o(n,t[u],r)&&(e[e.length]=t[u]);return Me(n,e)}),ou=function(n){for(var t=yr(n),r=t.length,e=-1,u={};++e<r;){var i=t[e],o=n[i];or(o,u)||(u[o]=[]),u[o].push(i)}return u},cu=function(n){for(var t=yr(n),r=t.length,e=-1,u={};++e<r;){var i=t[e];u[n[i]]=i}return u},au=Rr(-1),fu=vt(function(n,t){var r=Lt(n,t);if(0===arguments.length)throw O();return Lt(n,function(){return k(Le,br(r,arguments[0]),P(arguments,1))})}),lu=function(t){if(2!==t.length)throw new Error("Expected binary function.");return function r(e,u){switch(arguments.length){case 0:throw O();case 1:return e===n?C(r):Lr(t,e);default:return e===n?C(t)(u):t(e,u)}}},su=Dr("."),hu=Zr(b,1),gu=vt(function(n,t){return je(T(n),t)}),pu=lu(function(n,t){return n-t}),mu=vt(Nt(ke,i)),yu=dt(function(n,t,r){return Me(n,i(t,r))}),vu=function(n){var t=P(arguments,1),r=t.length;return Xe(S(r,function(){for(var e=[],u=-1;++u<r;)e[e.length]=t[u](arguments[u]);return n.apply(this,e.concat(P(arguments,r)))}))},du=Qe(br(F)),wu=lu(function(n,t){if(p(t))return i(n,t);if(wt("concat",n))return n.concat(t);throw new TypeError("can't concat "+typeof n)}),bu=vt(function(n,t){if(n>10)throw new Error("Constructor with greater than ten arguments");return 0===n?function(){return new t}:Xe(G(n,function(n,r,e,u,i,o,c,a,f,l){switch(arguments.length){case 1:return new t(n);case 2:return new t(n,r);case 3:return new t(n,r,e);case 4:return new t(n,r,e,u);case 5:return new t(n,r,e,u,i);case 6:return new t(n,r,e,u,i,o);case 7:return new t(n,r,e,u,i,o,c);case 8:return new t(n,r,e,u,i,o,c,a);case 9:return new t(n,r,e,u,i,o,c,a,f);case 10:return new t(n,r,e,u,i,o,c,a,f,l)}}))}),Ou=lu(gt),ju=lu(function(n,t){return n/t}),xu=lu(h),Au=lu(function(n,t){return n>=t}),Iu=function(n){if(0===arguments.length)throw O();return fu(n.length,n)},Eu=lu(d),ku=lu(function(n,t){return t>=n}),Mu=lu(function(n,t){return m(n)?!m(t)||1>t?0/0:(n%t+t)%t:0/0}),Pu=lu(function(n,t){return Fe(Fe({},n),t)}),Tu=Zr(Pu,{}),Su=lu(function(n,t){return n%t}),Wu=vu(w,_r,F),Nu=function(n){return bu(n.length,n)},Ru={F:ot,I:ct,T:at,__:n,add:xt,all:At,allPass:De,always:T,and:It,any:Et,anyPass:Ue,ap:_e,append:kt,appendTo:Mt,apply:Pt,arity:S,assoc:$e,assocPath:Ge,binary:Tt,bind:St,call:W,chain:He,charAt:Je,charCodeAt:Ke,clone:Wt,commute:du,commuteMap:Qe,comparator:N,compose:Nt,composeP:Rt,concat:wu,cond:R,construct:Nu,constructN:bu,contains:Ou,containsWith:qt,converge:q,countBy:Ve,createMapEntry:Ct,curry:Xe,curryN:Lt,dec:Bt,defaultTo:Ft,difference:zt,differenceWith:Dt,dissoc:Ut,divide:ju,drop:_t,dropWhile:$t,empty:Gt,eq:Ht,eqDeep:Ye,eqProps:Jt,evolve:Ze,filter:Kt,filterIndexed:Qt,find:Vt,findIndex:Xt,findLast:Yt,findLastIndex:Zt,flatten:nr,flip:C,forEach:tr,forEachIndexed:rr,fromPairs:L,func:B,functions:nu,functionsIn:er,get:ur,groupBy:ir,gt:xu,gte:Au,has:or,hasIn:cr,head:tu,identity:F,ifElse:ar,inc:fr,indexOf:lr,init:ru,insert:sr,insertAll:hr,installTo:eu,intersection:uu,intersectionWith:iu,invert:ou,invertObj:cu,invoker:gr,is:pr,isArrayLike:z,isEmpty:D,isNil:U,isSet:_,join:mr,keys:yr,keysIn:$,last:au,lastIndexOf:vr,length:dr,lens:wr,lift:Iu,liftN:fu,lt:Eu,lte:ku,map:br,mapAccum:Or,mapAccumRight:jr,mapIndexed:xr,mapObj:Ar,mapObjIndexed:Ir,match:Er,mathMod:Mu,max:kr,maxBy:Mr,memoize:Pr,merge:Pu,mergeAll:Tu,min:Tr,minBy:Sr,modulo:Su,multiply:Wr,nAry:G,negate:Nr,not:H,nth:Rr,nthArg:J,of:K,omit:qr,once:Q,op:lu,or:Cr,partial:Lr,partialRight:Br,partition:Fr,path:su,pathEq:zr,pathOn:Dr,pick:Ur,pickAll:_r,pickBy:$r,pipe:Gr,pipeP:Hr,pluck:Jr,prepend:Kr,prependTo:V,product:hu,project:Wu,prop:X,propEq:Qr,propOf:Y,propOr:Vr,props:Xr,range:Yr,reduce:Zr,reduceIndexed:ne,reduceRight:te,reduceRightIndexed:re,reject:ee,rejectIndexed:ue,remove:ie,repeat:gu,replace:oe,reverse:Z,scan:ce,slice:ae,sort:fe,sortBy:le,split:se,strIndexOf:he,strLastIndexOf:ge,substring:pe,substringFrom:me,substringTo:ye,subtract:pu,sum:ve,tail:de,take:we,takeWhile:be,tap:Oe,times:je,toLower:xe,toPairs:Ae,toPairsIn:nt,toUpper:Ie,trim:tt,type:rt,unapply:et,unary:ut,unfold:Ee,union:mu,unionWith:yu,uniq:ke,uniqWith:Me,unnest:Pe,useWith:vu,values:Te,valuesIn:it,where:Se,wrap:We,xprod:Ne,zip:Re,zipObj:qe,zipWith:Ce};"object"==typeof exports?module.exports=Ru:"function"==typeof define&&define.amd?define(function(){return Ru}):this.R=Ru}).call(this); | ||
(function(){"use strict";var n={ramda:"placeholder"},t=function(n,t){return n+t},r=function(n,t){for(var r=-1;++r<t.length;)if(!n(t[r]))return!1;return!0},e=function(n,t){for(var r=-1;++r<t.length;)if(n(t[r]))return!0;return!1},u=function(n,t,r){var e={};for(var u in r)e[u]=r[u];return e[n]=t,e},i=function(n,t){return function(){return n.call(this,t.apply(this,arguments))}},o=function(n,t){n=n||[],t=t||[];var r,e=n.length,u=t.length,i=[];for(r=-1;++r<e;)i[i.length]=n[r];for(r=-1;++r<u;)i[i.length]=t[r];return i},c=function(n,t,r){for(var e=-1,u=r.length;++e<u;)if(n(t,r[e]))return!0;return!1},f=function(n){return function(t,r){if(r&&r.length>0){for(var e,u=0,i=r[u],o=t(i);++u<r.length;)e=t(r[u]),n(e,o)&&(o=e,i=r[u]);return i}}},a=function(t){return function r(e){return 0===arguments.length?r:e===n?r:t(e)}},l=function(t){return function r(e,u){var i=arguments.length;return 0===i?r:1===i&&e===n?r:1===i?a(function(n){return t(e,n)}):2===i&&e===n&&u===n?r:2===i&&e===n?a(function(n){return t(n,u)}):2===i&&u===n?a(function(n){return t(e,n)}):t(e,u)}},s=function(t){return function r(e,u,i){var o=arguments.length;return 0===o?r:1===o&&e===n?r:1===o?l(function(n,r){return t(e,n,r)}):2===o&&e===n&&u===n?r:2===o&&e===n?l(function(n,r){return t(n,u,r)}):2===o&&u===n?l(function(n,r){return t(e,n,r)}):2===o?a(function(n){return t(e,u,n)}):3===o&&e===n&&u===n&&i===n?r:3===o&&e===n&&u===n?l(function(n,r){return t(n,r,i)}):3===o&&e===n&&i===n?l(function(n,r){return t(n,u,r)}):3===o&&u===n&&i===n?l(function(n,r){return t(e,n,r)}):3===o&&e===n?a(function(n){return t(n,u,i)}):3===o&&u===n?a(function(n){return t(e,n,i)}):3===o&&i===n?a(function(n){return t(e,u,n)}):t(e,u,i)}},h=function(n,t){var r={};for(var e in t)e!==n&&(r[e]=t[e]);return r},g=function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)n(t[r])&&(u[u.length]=t[r]);return u},p=function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)n(t[r],r,t)&&(u[u.length]=t[r]);return u},m=function(n,t){for(var r=-1,e=t.length;++r<e;)n(t[r]);return t},v=function(n){return function(t){return g(function(n){return"function"==typeof t[n]},n(t))}},y=function(n,t){return n>t},d=function(n,t){return Object.prototype.hasOwnProperty.call(t,n)},b=function(n,t,r){var e=0,u=n.length;for("number"==typeof r&&(e=0>r?Math.max(0,u+r):r);u>e;){if(n[e]===t)return e;++e}return-1},w=Array.isArray||function(n){return null!=n&&n.length>=0&&"[object Array]"===Object.prototype.toString.call(n)},O=Number.isInteger||function(n){return n<<0===n},j=function(n){return null!=n&&n===Object(n)&&"function"==typeof n.then},x=function(n,t,r){var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},I=function(n,t){return t>n},A=function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)u[r]=n(t[r]);return u},k=function(n,t){return n*t},E=function(n,t){return 0>n?t[t.length+n]:t[n]},P=function(n){return function(t){return A(function(n){return[n,t[n]]},n(t))}},M=function(n,t){if(null!=t&&0!==n.length){for(var r=t,e=0,u=n.length;u>e&&null!=r;e+=1)r=r[n[e]];return r}},S=function(n,t){var r={};return m(function(n){r[n]=t[n]},n),r},T=function(n,t){return o([n],t)},W=function(n,t,r){for(var e=-1,u=r.length;++e<u;)t=n(t,r[e]);return t},N=function(n,t,r){if(n===r)return!0;if(null==r)return!1;t.fn=t.fn||[],t.obj=t.obj||[];for(var e,u,i=-1,o=t.fn.length,c=-1,f=t.obj.length;++i<o;){if(e=t.fn[i],u=n[e],!(e in r))return!1;if(!u(r[e],r))return!1}for(;++c<f;)if(e=t.obj[c],n[e]!==r[e])return!1;return!0},R=function zu(n,t,r){switch(arguments.length){case 1:return zu(n,0,n.length);case 2:return zu(n,t,n.length);default:for(var e=Math.max(0,r-t),u=[],i=-1;++i<e;)u[i]=n[t+i];return u}},q=l(t),C=l(r),L=a(function(n){return function(){return n}}),B=l(function(n,t){return function(){return n.apply(this,arguments)&&t.apply(this,arguments)}}),z=l(e),D=l(function(n,t){return n.apply(this,t)}),F=l(function(n,t){switch(n){case 0:return function(){return t.apply(this,arguments)};case 1:return function(n){return t.apply(this,arguments)};case 2:return function(n,r){return t.apply(this,arguments)};case 3:return function(n,r,e){return t.apply(this,arguments)};case 4:return function(n,r,e,u){return t.apply(this,arguments)};case 5:return function(n,r,e,u,i){return t.apply(this,arguments)};case 6:return function(n,r,e,u,i,o){return t.apply(this,arguments)};case 7:return function(n,r,e,u,i,o,c){return t.apply(this,arguments)};case 8:return function(n,r,e,u,i,o,c,f){return t.apply(this,arguments)};case 9:return function(n,r,e,u,i,o,c,f,a){return t.apply(this,arguments)};case 10:return function(n,r,e,u,i,o,c,f,a,l){return t.apply(this,arguments)};default:throw new Error("First argument to arity must be a non-negative integer no greater than ten")}}),U=s(u),_=l(function(n,t){return F(n.length,function(){return n.apply(t,arguments)})}),$=a(function(n){return function(t,r){return n(t,r)?-1:n(r,t)?1:0}}),G=function(){var n=arguments;return function(){for(var t=-1;++t<n.length;)if(n[t][0].apply(this,arguments))return n[t][1].apply(this,arguments)}},H=s(c),J=l(function(n,t){for(var r={},e=t.length,u=-1;++u<e;){var i=n(t[u]);r[i]=(d(i,r)?r[i]:0)+1}return r}),K=l(function(n,t){var r={};return r[n]=t,r}),Q=l(function Du(t,r){return F(t,function(){for(var e=arguments.length,u=t-e,i=e;i--;)arguments[i]===n&&(u+=1);if(0>=u)return r.apply(this,arguments);var o=R(arguments);return Du(u,function(){for(var t=R(arguments),u=[],i=-1;++i<e;){var c=o[i];u[i]=c===n?t.shift():c}return r.apply(this,u.concat(t))})})}),V=q(-1),X=l(function(n,t){return null==t?n:t}),Y=s(function(n,t,r){for(var e=[],u=-1,i=t.length,o=H(n);++u<i;)o(t[u],r)||o(t[u],e)||(e[u]=t[u]);return e}),Z=l(h),nt=l(function(n,t){return n/t}),tt=l(function(n,t){for(var r=-1,e=t.length;++r<e&&n(t[r]););return R(t,r)}),rt=l(function(n,t){return 0===n?1/n===1/t:n===t||n!==n&&t!==t}),et=s(function(n,t,r){return t[n]===r[n]}),ut=l(p),it=l(function(n,t){for(var r=-1,e=t.length;++r<e;)if(n(t[r]))return t[r]}),ot=l(function(n,t){for(var r=-1,e=t.length;++r<e;)if(n(t[r]))return r;return-1}),ct=l(function(n,t){for(var r=t.length;r--;)if(n(t[r]))return t[r]}),ft=l(function(n,t){for(var r=t.length;r--;)if(n(t[r]))return r;return-1}),at=l(m),lt=l(function(n,t){for(var r=-1,e=t.length;++r<e;)n(t[r],r,t);return t}),st=a(function(n){for(var t=-1,r=n.length,e={};++t<r;)w(n[t])&&n[t].length&&(e[n[t][0]]=n[t][1]);return e}),ht=l(y),gt=l(function(n,t){return n>=t}),pt=l(d),mt=l(function(n,t){return n in t}),vt=a(function(n){return n}),yt=s(function(n,t,r){return function(){return n.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)}}),dt=q(1),bt=l(function(n,t){return b(t,n)}),wt=s(function(n,t,r){return n=n<r.length&&n>=0?n:r.length,o(o(R(r,0,n),t),R(r,n))}),Ot=l(function(n,t){return null!=t&&t.constructor===n||t instanceof n}),jt=a(function(n){return w(n)?!0:n?"object"!=typeof n?!1:n instanceof String?!1:1===n.nodeType?!!n.length:0===n.length?!0:n.length>0?n.hasOwnProperty(0)&&n.hasOwnProperty(n.length-1):!1:!1}),xt=a(function(n){return 0===Object(n).length}),It=a(function(n){return null==n}),At=a(function(n){for(var t=n.length,r=-1;++r<t;)if(b(n,n[r],r+1)>=0)return!1;return!0}),kt=a(function(n){var t,r=[];for(t in n)r[r.length]=t;return r}),Et=l(function(n,t){return x(t,n)}),Pt=a(function(n){return null!=n&&Ot(Number,n.length)?n.length:0/0}),Mt=l(function(n,t){var r=function(t){return n(t)};return r.set=l(t),r.map=l(function(r,e){return t(r(n(e)),e)}),r}),St=s(function(n,t,r){var e=function(){return n(r)};return e.set=t,e.map=function(e){return t(e(n(r)))},e}),Tt=l(I),Wt=l(function(n,t){return t>=n}),Nt=s(function(n,t,r){for(var e=-1,u=r.length,i=[],o=[t];++e<u;)o=n(o[0],r[e]),i[e]=o[1];return[o[0],i]}),Rt=s(function(n,t,r){for(var e=r.length,u=[],i=[t];e--;)i=n(i[0],r[e]),u[e]=i[1];return[i[0],u]}),qt=l(function(n,t){for(var r=-1,e=t.length,u=[];++r<e;)u[r]=n(t[r],r,t);return u}),Ct=l(function(n,t){return O(n)?!O(t)||1>t?0/0:(n%t+t)%t:0/0}),Lt=l(f(y)),Bt=function(){var n=function(n){return n+"::"+Object.prototype.toString.call(n)},t=function(t){return t.length+":{"+A(n,t).join(",")+"}"};return a(function(n){var r={};return function(){var e=t(arguments);return d(e,r)||(r[e]=n.apply(this,arguments)),r[e]}})}(),zt=l(f(I)),Dt=l(function(n,t){return n%t}),Ft=l(k),Ut=l(function(n,t){switch(n){case 0:return function(){return t.call(this)};case 1:return function(n){return t.call(this,n)};case 2:return function(n,r){return t.call(this,n,r)};case 3:return function(n,r,e){return t.call(this,n,r,e)};case 4:return function(n,r,e,u){return t.call(this,n,r,e,u)};case 5:return function(n,r,e,u,i){return t.call(this,n,r,e,u,i)};case 6:return function(n,r,e,u,i,o){return t.call(this,n,r,e,u,i,o)};case 7:return function(n,r,e,u,i,o,c){return t.call(this,n,r,e,u,i,o,c)};case 8:return function(n,r,e,u,i,o,c,f){return t.call(this,n,r,e,u,i,o,c,f)};case 9:return function(n,r,e,u,i,o,c,f,a){return t.call(this,n,r,e,u,i,o,c,f,a)};case 10:return function(n,r,e,u,i,o,c,f,a,l){return t.call(this,n,r,e,u,i,o,c,f,a,l)};default:throw new Error("First argument to nAry must be a non-negative integer no greater than ten")}}),_t=a(function(n){return-n}),$t=a(function(n){return function(){return!n.apply(this,arguments)}}),Gt=l(E),Ht=a(function(n){return function(){return E(n,arguments)}}),Jt=a(function(n){return[n]}),Kt=l(function(n,t){var r={};for(var e in t)b(n,e)<0&&(r[e]=t[e]);return r}),Qt=a(function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments))}}),Vt=l(function(n,t){return function(){return n.apply(this,arguments)||t.apply(this,arguments)}}),Xt=l(function(n,t){return W(function(t,r){var e=t[n(r)?0:1];return e[e.length]=r,t},[[],[]],t)}),Yt=l(M),Zt=s(function(n,t,r){return M(n,r)===t}),nr=l(function(n,t){var r={};for(var e in t)b(n,e)>=0&&(r[e]=t[e]);return r}),tr=l(S),rr=l(function(n,t){var r={};for(var e in t)n(t[e],e,t)&&(r[e]=t[e]);return r}),er=l(T),ur=l(function(n,t){return t[n]}),ir=s(function(n,t,r){return r[n]===t}),or=s(function(n,t,r){return d(t,r)?r[t]:n}),cr=l(function(n,t){for(var r=n.length,e=[],u=-1;++u<r;)e[u]=t[n[u]];return e}),fr=l(function(n,t){if(n>=t)return[];for(var r=0,e=[];t>n;)e[r]=n++,r+=1;return e}),ar=s(W),lr=s(function(n,t,r){for(var e=-1,u=r.length;++e<u;)t=n(t,r[e],e,r);return t}),sr=s(function(n,t,r){for(var e=r.length;e--;)t=n(t,r[e]);return t}),hr=s(function(n,t,r){for(var e=r.length;e--;)t=n(t,r[e],e,r);return t}),gr=l(function(n,t){return p($t(n),t)}),pr=s(function(n,t,r){return o(R(r,0,Math.min(n,r.length)),R(r,Math.min(r.length,n+t)))}),mr=s(function(n,t,r){return r.replace(n,t)}),vr=a(function(n){return R(n).reverse()}),yr=s(function(n,t,r){for(var e=0,u=r.length+1,i=[t];++e<u;)t=n(t,r[e-1]),i[e]=t;return i}),dr=l(function(n,t){return R(t).sort(function(t,r){var e=n(t),u=n(r);return u>e?-1:e>u?1:0})}),br=l(function(n,t){return t.indexOf(n)}),wr=l(function(n,t){return t.lastIndexOf(n)}),Or=l(function(n,t){return n-t}),jr=ar(t,0),xr=l(function(n,t){return n(t),t}),Ir=l(function(n,t){for(var r=Number(t),e=new Array(r),u=0;r>u;)e[u]=n(u),u+=1;return e}),Ar=a(P(kt)),kr=function(){var n=" \n\f\r \u2028\u2029",t="",r="function"==typeof String.prototype.trim;return a(r&&!n.trim()&&t.trim()?function(n){return n.trim()}:function(t){var r=new RegExp("^["+n+"]["+n+"]*"),e=new RegExp("["+n+"]["+n+"]*$");return t.replace(r,"").replace(e,"")})}(),Er=a(function(n){return null===n?"Null":void 0===n?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}),Pr=a(function(n){return function(){return n(R(arguments))}}),Mr=a(function(n){return Ut(1,n)}),Sr=l(function(n,t){for(var r=n(t),e=[];r&&r.length;)e[e.length]=r[0],r=n(r[1]);return e}),Tr=l(function(n,t){for(var r,e=-1,u=t.length,i=[];++e<u;)r=t[e],c(n,r,i)||(i[i.length]=r);return i}),Wr=a(function(n){var t,r=[];for(t in n)r[r.length]=n[t];return r}),Nr=l(function(n,t){return Q(n.length,function(){return t.apply(this,o([n],arguments))})}),Rr=l(function(n,t){for(var r,e=-1,u=n.length,i=t.length,o=[];++e<u;)for(r=-1;++r<i;)o[o.length]=[n[e],t[r]];return o}),qr=l(function(n,t){for(var r=[],e=-1,u=Math.min(n.length,t.length);++e<u;)r[e]=[n[e],t[e]];return r}),Cr=l(function(n,t){for(var r=-1,e=n.length,u={};++r<e;)u[n[r]]=t[r];return u}),Lr=s(function(n,t,r){for(var e=[],u=-1,i=Math.min(t.length,r.length);++u<i;)e[u]=n(t[u],r[u]);return e}),Br=L(!1),zr=vt,Dr=L(!0),Fr=function(n,t){return o(t,[n])},Ur=function Fu(n,t,r){switch(n.length){case 0:return r;case 1:return u(n[0],t,r);default:return u(n[0],Fu(R(n,1),t,Object(r[n[0]])),r)}},_r=function Uu(n,t,r){var e=function(e){for(var u=t.length,i=-1;++i<u;)if(n===t[i])return r[i];t[i+1]=n,r[i+1]=e;for(var o in n)e[o]=Uu(n[o],t,r);return e};switch(Er(n)){case"Object":return e({});case"Array":return e([]);case"Date":return new Date(n);default:return n}},$r=function(n,t){return function(){var r=arguments.length;if(0===r)return t();var e=arguments[r-1];return w(e)||"function"!=typeof e[n]?t.apply(this,arguments):e[n].apply(e,R(arguments,0,r-1))}},Gr=function(n,t){return function(){var r=this,e=t.apply(this,arguments);return j(e)?e.then(function(t){return n.call(r,t)}):n.call(this,e)}},Hr=function(n,t){return b(t,n)>=0},Jr=function(n){return function(){for(var t=arguments.length-1,r=arguments[t],e=r.length;t--;)r=n(arguments[t],r);return F(e,r)}},Kr=function(n,t){return a(function(r){for(var e,u=-1,i=t;++u<r.length;)e=+r[u],n(e,i)&&(i=e);return i})},Qr=function(n){return function(t){var r=R(arguments,1);return F(Math.max(0,t.length-r.length),function(){return t.apply(this,n(r,arguments))})}},Vr=function _u(n,t){switch(n.length){case 0:return t;case 1:return h(n[0],t);default:var r=n[0],e=R(n,1);return null==t[r]?t:u(r,_u(e,t[r]),t)}},Xr=function(n,t){return null!=t&&!w(t)&&"function"==typeof t[n]},Yr=function(n){return function t(r){for(var e,u,i,o=[],c=-1,f=r.length;++c<f;)if(jt(r[c]))for(e=n?t(r[c]):r[c],u=-1,i=e.length;++u<i;)o[o.length]=e[u];else o[o.length]=r[c];return o}},Zr=function(n,t){return A(ur(n),t)},ne=l(Fr),te=s(Ur),re=a(function(n){return Ut(2,n)}),ee=a(function(n){return _r(n,[],[])}),ue=Jr(i),ie=Jr(Gr),oe=l(function(n,t){if(w(t))return o(n,t);if(Xr("concat",n))return n.concat(t);throw new TypeError("can't concat "+typeof n)}),ce=l(Hr),fe=Q(3,function(n){var t=R(arguments,1);return function(){var r=arguments;return n.apply(this,A(function(n){return n.apply(this,r)},t))}}),ae=a(function(n){return Q(n.length,n)}),le=l(function(n,t){for(var r=[],e=-1,u=n.length;++e<u;)Hr(n[e],t)||Hr(n[e],r)||(r[r.length]=n[e]);return r}),se=l(Vr),he=l($r("drop",function(n,t){return n<t.length?R(t,n):[]})),ge=a(function(n){return Xr("empty",n)?n.empty():[]}),pe=l($r("filter",g)),me=a(Yr(!0)),ve=a(function(n){return ae(function(t,r){var e=R(arguments);return e[0]=r,e[1]=t,n.apply(this,e)})}),ye=ae(function(n,t){return t[n].apply(t,R(arguments,2))}),de=a(v(kt)),be=ur,we=l(function(n,t){return W(function(t,r){var e=n(r);return t[e]=Fr(r,t[e]||(t[e]=[])),t},{},t)}),Oe=Gt(0),je=s(function(n,t,r){return n=n<r.length&&n>=0?n:r.length,o(Fr(t,R(r,0,n)),R(r,n))}),xe=s(function(n,t,r){for(var e=[],u=-1;++u<t.length;)c(n,t[u],r)&&(e[e.length]=t[u]);return Tr(n,e)}),Ie=ae(function(n,t){var r=R(arguments,2),e=n-r.length;return Q(e+1,function(){var n=arguments[e],u=r.concat(R(arguments,0,e));return n[t].apply(n,u)})}),Ae=Ie(1,"join"),ke=function(){var n=!{toString:null}.propertyIsEnumerable("toString"),t=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];return a(function(r){if(Object(r)!==r)return[];if(Object.keys)return Object.keys(r);var e,u,i=[];for(e in r)d(e,r)&&(i[i.length]=e);if(n)for(u=t.length;u--;)e=t[u],d(e,r)&&!Hr(e,i)&&(i[i.length]=e);return i})}(),Ee=Gt(-1),Pe=l($r("map",A)),Me=l(function(n,t){return W(function(r,e){return r[e]=n(t[e]),r},{},ke(t))}),Se=l(function(n,t){return W(function(r,e){return r[e]=n(t[e],e,t),r},{},ke(t))}),Te=Ie(1,"match"),We=Kr(y,-1/0),Ne=Kr(I,1/0),Re=ae(Qr(o)),qe=ae(Qr(ve(o))),Ce=function(){return ue.apply(this,vr(arguments))},Le=function(){return ie.apply(this,vr(arguments))},Be=l(Zr),ze=ve(T),De=ar(k,1),Fe=ve(ur),Ue=l(function(n,t){return pe($t(n),t)}),_e=l(function(n,t){return Ir(L(n),t)}),$e=s($r("slice",function(n,t,r){return Array.prototype.slice.call(r,n,t)})),Ge=l(function(n,t){return ee(t).sort(n)}),He=Ie(1,"split"),Je=Ie(2,"substring"),Ke=ve(Je)(void 0),Qe=Je(0),Ve=$r("tail",function(n){return R(n,1)}),Xe=l($r("take",function(n,t){return R(t,0,Math.min(n,t.length))})),Ye=l($r("takeWhile",function(n,t){for(var r=-1,e=t.length;++r<e&&n(t[r]););return R(t,0,r)})),Ze=Ie(0,"toLowerCase"),nu=a(P(ke)),tu=Ie(0,"toUpperCase"),ru=s(function(n,t,r){return Tr(n,o(t,r))}),eu=a(function(n){for(var t,r=-1,e=n.length,u=[];++r<e;)t=n[r],Hr(t,u)||(u[u.length]=t);return u}),uu=a(Yr(!1)),iu=ae(function(n){var t=R(arguments,1),r=t.length;return ae(F(r,function(){for(var e=[],u=-1;++u<r;)e[u]=t[u](arguments[u]);return n.apply(this,e.concat(R(arguments,r)))}))}),ou=a(function(n){for(var t=ke(n),r=t.length,e=[],u=-1;++u<r;)e[u]=n[t[u]];return e}),cu=l(function(n,t){var r=we(function(t){return"function"==typeof n[t]?"fn":"obj"},ke(n));return N(n,r,t)}),fu=function(n,t){return Xr("ap",n)?n.ap(t):W(function(n,r){return o(n,A(r,t))},[],n)},au=function $u(n,t,r,e){var u=Er(n);if(u!==Er(t))return!1;if(rt(n,t))return!0;if("RegExp"==u)return n.source===t.source&&n.global===t.global&&n.ignoreCase===t.ignoreCase&&n.multiline===t.multiline&&n.sticky===t.sticky&&n.unicode===t.unicode;if(Object(n)===n){if("Date"===u&&n.getTime()!=t.getTime())return!1;var i=ke(n);if(i.length!==ke(t).length)return!1;for(var o=r.length;o--;)if(r[o]===n)return e[o]===t;for(r[r.length]=n,e[e.length]=t,o=i.length;o--;){var c=i[o];if(!d(c,t)||!$u(t[c],n[c],r,e))return!1}return r.pop(),e.pop(),!0}return!1},lu=function(n,t){for(var r=ke(t),e=-1,u=r.length;++e<u;)n[r[e]]=t[r[e]];return n},su=function(n){return function(t){var r=function(){var r=arguments;return n(function(n){return n.apply(null,r)},t)};return arguments.length>1?r.apply(null,R(arguments,1)):F(We(Zr("length",t)),r)}},hu=ae(su(r)),gu=ae(su(e)),pu=l(fu),mu=ve(Fr),vu=ae(function(n){return n.apply(this,R(arguments,1))}),yu=l($r("chain",function(n,t){return uu(A(n,t))})),du=Ie(1,"charAt"),bu=Ie(1,"charCodeAt"),wu=s(function(n,t,r){function e(t,r){return fu(A(ne,n(r)),t)}return W(e,t([]),r)}),Ou=l(function(n,t){if(n>10)throw new Error("Constructor with greater than ten arguments");return 0===n?function(){return new t}:ae(Ut(n,function(n,r,e,u,i,o,c,f,a,l){switch(arguments.length){case 1:return new t(n);case 2:return new t(n,r);case 3:return new t(n,r,e);case 4:return new t(n,r,e,u);case 5:return new t(n,r,e,u,i);case 6:return new t(n,r,e,u,i,o);case 7:return new t(n,r,e,u,i,o,c);case 8:return new t(n,r,e,u,i,o,c,f);case 9:return new t(n,r,e,u,i,o,c,f,a);case 10:return new t(n,r,e,u,i,o,c,f,a,l)}}))}),ju=l(function(n,t){return au(n,t,[],[])}),xu=l(function(n,t){return lu(lu({},t),Se(function(n,r){return n(t[r])},n))}),Iu=a(v(ke)),Au=$e(0,-1),ku=a(function(n){return lu(n,Bu)}),Eu=l(function(n,t){return eu(g(ve(Hr)(n),t))}),Pu=a(function(n){for(var t=ke(n),r=t.length,e=-1,u={};++e<r;){var i=t[e],o=n[i],c=d(o,u)?u[o]:u[o]=[];c[c.length]=i}return u}),Mu=a(function(n){for(var t=ke(n),r=t.length,e=-1,u={};++e<r;){var i=t[e];u[n[i]]=i}return u}),Su=l(function(n,t){var r=Q(n,t);return Q(n,function(){return W(fu,Pe(r,arguments[0]),R(arguments,1))})}),Tu=l(function(n,t){return lu(lu({},n),t)}),Wu=a(function(n){return ar(Tu,{},n)}),Nu=iu(A,tr,vt),Ru=l(ue(eu,o)),qu=wu(Pe(vt)),Cu=a(function(n){return Ou(n.length,n)}),Lu=a(function(n){return Su(n.length,n)}),Bu={F:Br,I:zr,T:Dr,__:n,add:q,all:C,allPass:hu,always:L,and:B,any:z,anyPass:gu,ap:pu,append:ne,appendTo:mu,apply:D,arity:F,assoc:U,assocPath:te,binary:re,bind:_,call:vu,chain:yu,charAt:du,charCodeAt:bu,clone:ee,commute:qu,commuteMap:wu,comparator:$,compose:ue,composeP:ie,concat:oe,cond:G,construct:Cu,constructN:Ou,contains:ce,containsWith:H,converge:fe,countBy:J,createMapEntry:K,curry:ae,curryN:Q,dec:V,defaultTo:X,difference:le,differenceWith:Y,dissoc:Z,dissocPath:se,divide:nt,drop:he,dropWhile:tt,empty:ge,eq:rt,eqDeep:ju,eqProps:et,evolve:xu,filter:pe,filterIndexed:ut,find:it,findIndex:ot,findLast:ct,findLastIndex:ft,flatten:me,flip:ve,forEach:at,forEachIndexed:lt,fromPairs:st,func:ye,functions:Iu,functionsIn:de,get:be,groupBy:we,gt:ht,gte:gt,has:pt,hasIn:mt,head:Oe,identity:vt,ifElse:yt,inc:dt,indexOf:bt,init:Au,insert:je,insertAll:wt,installTo:ku,intersection:Eu,intersectionWith:xe,invert:Pu,invertObj:Mu,invoker:Ie,is:Ot,isArrayLike:jt,isEmpty:xt,isNil:It,isSet:At,join:Ae,keys:ke,keysIn:kt,last:Ee,lastIndexOf:Et,length:Pt,lens:Mt,lensOn:St,lift:Lu,liftN:Su,lt:Tt,lte:Wt,map:Pe,mapAccum:Nt,mapAccumRight:Rt,mapIndexed:qt,mapObj:Me,mapObjIndexed:Se,match:Te,mathMod:Ct,max:We,maxBy:Lt,memoize:Bt,merge:Tu,mergeAll:Wu,min:Ne,minBy:zt,modulo:Dt,multiply:Ft,nAry:Ut,negate:_t,not:$t,nth:Gt,nthArg:Ht,of:Jt,omit:Kt,once:Qt,or:Vt,partial:Re,partialRight:qe,partition:Xt,path:Yt,pathEq:Zt,pick:nr,pickAll:tr,pickBy:rr,pipe:Ce,pipeP:Le,pluck:Be,prepend:er,prependTo:ze,product:De,project:Nu,prop:ur,propEq:ir,propOf:Fe,propOr:or,props:cr,range:fr,reduce:ar,reduceIndexed:lr,reduceRight:sr,reduceRightIndexed:hr,reject:Ue,rejectIndexed:gr,remove:pr,repeat:_e,replace:mr,reverse:vr,scan:yr,slice:$e,sort:Ge,sortBy:dr,split:He,strIndexOf:br,strLastIndexOf:wr,substring:Je,substringFrom:Ke,substringTo:Qe,subtract:Or,sum:jr,tail:Ve,take:Xe,takeWhile:Ye,tap:xr,times:Ir,toLower:Ze,toPairs:nu,toPairsIn:Ar,toUpper:tu,trim:kr,type:Er,unapply:Pr,unary:Mr,unfold:Sr,union:Ru,unionWith:ru,uniq:eu,uniqWith:Tr,unnest:uu,useWith:iu,values:ou,valuesIn:Wr,where:cu,wrap:Nr,xprod:Rr,zip:qr,zipObj:Cr,zipWith:Lr};"object"==typeof exports?module.exports=Bu:"function"==typeof define&&define.amd?define(function(){return Bu}):this.R=Bu}).call(this); |
@@ -27,3 +27,3 @@ { | ||
"description": "A practical functional library for JavaScript programmers.", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"homepage": "https://www.github.com/ramda/ramda", | ||
@@ -62,3 +62,3 @@ "license": "MIT", | ||
"grunt-express": "^1.4.1", | ||
"grunt-jscs": "1.2.x", | ||
"grunt-jscs": "1.5.x", | ||
"grunt-jsdoc": "^0.6.1", | ||
@@ -74,5 +74,6 @@ "grunt-mocha": "~0.4.11", | ||
"marked": "^0.3.2", | ||
"mocha": "2.x.x", | ||
"orchestrate": "~0.3.4", | ||
"q": "^1.1.1", | ||
"ramda": "0.9.0", | ||
"ramda": "0.10.0", | ||
"testem": "^0.6.18", | ||
@@ -79,0 +80,0 @@ "uglify-js": "2.4.x", |
@@ -42,3 +42,3 @@ Ramda | ||
Also see [Why Ramda?](http://fr.umio.us/why-ramda/), [Why Curry Helps](http://hughfdjackson.com/javascript/why-curry-helps/) and [Hey Underscore, You're Doing It Wrong!](https://www.youtube.com/watch?v=m3svKOdZijA&app=desktop). | ||
Also see [Why Ramda?](http://fr.umio.us/why-ramda/), [Why Curry Helps](https://web.archive.org/web/20140714014530/http://hughfdjackson.com/javascript/why-curry-helps) and [Hey Underscore, You're Doing It Wrong!](https://www.youtube.com/watch?v=m3svKOdZijA&app=desktop). | ||
@@ -103,10 +103,10 @@ | ||
```html | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.10.0/ramda.min.js"></script> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.11.0/ramda.min.js"></script> | ||
``` | ||
or one of the below links from [jsDelivr](http://jsdelivr.net): | ||
or one of the below links from [jsDelivr](http://jsdelivr.com): | ||
```html | ||
<script src="//cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/ramda/0.10/ramda.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/ramda/0.11.0/ramda.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/ramda/0.11/ramda.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/ramda/latest/ramda.min.js"></script> | ||
@@ -113,0 +113,0 @@ ``` |
var _all = require('./internal/_all'); | ||
var _predicateWrap = require('./internal/_predicateWrap'); | ||
var curry = require('./curry'); | ||
@@ -24,2 +25,2 @@ | ||
*/ | ||
module.exports = _predicateWrap(_all); | ||
module.exports = curry(_predicateWrap(_all)); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -15,6 +18,6 @@ * Returns a function that always returns the given value. | ||
*/ | ||
module.exports = function always(val) { | ||
module.exports = _curry1(function always(val) { | ||
return function() { | ||
return val; | ||
}; | ||
}; | ||
}); |
var _any = require('./internal/_any'); | ||
var _predicateWrap = require('./internal/_predicateWrap'); | ||
var curry = require('./curry'); | ||
@@ -25,2 +26,2 @@ | ||
*/ | ||
module.exports = _predicateWrap(_any); | ||
module.exports = curry(_predicateWrap(_any)); |
@@ -14,3 +14,3 @@ var _ap = require('./internal/_ap'); | ||
* @param {Array} vs An array of values | ||
* @return {Array} The value of applying each the function `fns` to each value in `vs`. | ||
* @return {Array} An array of results of applying each of `fns` to all of `vs` in turn. | ||
* @example | ||
@@ -17,0 +17,0 @@ * |
@@ -8,2 +8,3 @@ var _append = require('./internal/_append'); | ||
* | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -10,0 +11,0 @@ * @memberOf R |
@@ -0,1 +1,4 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
/** | ||
@@ -27,3 +30,3 @@ * Wraps a function of any arity (including nullary) in a function that accepts exactly `n` | ||
*/ | ||
module.exports = function(n, fn) { | ||
module.exports = _curry2(function(n, fn) { | ||
switch (n) { | ||
@@ -43,2 +46,2 @@ case 0: return function() {return fn.apply(this, arguments);}; | ||
} | ||
}; | ||
}); |
@@ -0,7 +1,3 @@ | ||
var _assoc = require('./internal/_assoc'); | ||
var _curry3 = require('./internal/_curry3'); | ||
var _extend = require('./internal/_extend'); | ||
var _map = require('./internal/_map'); | ||
var createMapEntry = require('./createMapEntry'); | ||
var fromPairs = require('./fromPairs'); | ||
var keysIn = require('./keysIn'); | ||
@@ -25,14 +21,4 @@ | ||
* | ||
* var obj1 = {a: 1, b: {c: 2, d: 3}, e: 4, f: 5}; | ||
* var obj2 = R.assoc('e', {x: 42}, obj1); | ||
* //=> {a: 1, b: {c: 2, d: 3}, e: {x: 42}, f: 5} | ||
* | ||
* // And moreover, obj2.b is a reference to obj1.b | ||
* // No unnecessary objects are created. | ||
* R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} | ||
*/ | ||
module.exports = _curry3(function assoc(prop, val, obj) { | ||
// rather than `clone` to get prototype props too, even though they're flattened | ||
return _extend(fromPairs(_map(function(key) { | ||
return [key, obj[key]]; | ||
}, keysIn(obj))), createMapEntry(prop, val)); | ||
}); | ||
module.exports = _curry3(_assoc); |
@@ -1,7 +0,3 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _slice = require('./internal/_slice'); | ||
var assoc = require('./assoc'); | ||
var is = require('./is'); | ||
var split = require('./split'); | ||
var _assocPath = require('./internal/_assocPath'); | ||
var _curry3 = require('./internal/_curry3'); | ||
@@ -11,3 +7,3 @@ | ||
* Makes a shallow clone of an object, setting or overriding the nodes | ||
* required to create the given path, and placing the specifiec value at the | ||
* required to create the given path, and placing the specific value at the | ||
* tail end of that path. Note that this copies and flattens prototype | ||
@@ -20,4 +16,4 @@ * properties onto the new object as well. All non-primitive properties | ||
* @category Object | ||
* @sig String -> a -> {k: v} -> {k: v} | ||
* @param {String} path the dot-delimited path to set | ||
* @sig [String] -> a -> {k: v} -> {k: v} | ||
* @param {Array} path the path to set | ||
* @param {*} val the new value | ||
@@ -28,27 +24,4 @@ * @param {Object} obj the object to clone | ||
* | ||
* var obj1 = {a: {b: 1, c: 2, d: {e: 3}}, f: {g: {h: 4, i: 5, j: {k: 6, l: 7}}}, m: 8}; | ||
* var obj2 = R.assocPath('f.g.i', {x: 42}, obj1); | ||
* //=> {a: {b: 1, c: 2, d: {e: 3}}, f: {g: {h: 4, i: {x: 42}, j: {k: 6, l: 7}}}, m: 8} | ||
* R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} | ||
*/ | ||
module.exports = (function() { | ||
var setParts = function(parts, val, obj) { | ||
if (parts.length === 1) {return assoc(parts[0], val, obj);} | ||
var current = obj[parts[0]]; | ||
return assoc(parts[0], setParts(_slice(parts, 1), val, is(Object, current) ? current : {}), obj); | ||
}; | ||
return function(path, val, obj) { | ||
var length = arguments.length; | ||
if (length === 0) { | ||
throw _noArgsException(); | ||
} | ||
var parts = split('.', path); | ||
var fn = _curry2(function(val, obj) { | ||
return setParts(parts, val, obj); | ||
}); | ||
switch (length) { | ||
case 1: return fn; | ||
case 2: return fn(val); | ||
default: return fn(val, obj); | ||
} | ||
}; | ||
}()); | ||
module.exports = _curry3(_assocPath); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var nAry = require('./nAry'); | ||
@@ -28,4 +29,4 @@ | ||
*/ | ||
module.exports = function binary(fn) { | ||
module.exports = _curry1(function binary(fn) { | ||
return nAry(2, fn); | ||
}; | ||
}); |
var _curry2 = require('./internal/_curry2'); | ||
var arity = require('./arity'); | ||
@@ -19,5 +20,5 @@ | ||
module.exports = _curry2(function bind(fn, thisObj) { | ||
return function() { | ||
return arity(fn.length, function() { | ||
return fn.apply(thisObj, arguments); | ||
}; | ||
}); | ||
}); |
var _slice = require('./internal/_slice'); | ||
var curry = require('./curry'); | ||
@@ -29,4 +30,4 @@ | ||
*/ | ||
module.exports = function call(fn) { | ||
module.exports = curry(function call(fn) { | ||
return fn.apply(this, _slice(arguments, 1)); | ||
}; | ||
}); |
var _baseCopy = require('./internal/_baseCopy'); | ||
var _curry1 = require('./internal/_curry1'); | ||
@@ -22,4 +23,4 @@ | ||
*/ | ||
module.exports = function clone(value) { | ||
module.exports = _curry1(function clone(value) { | ||
return _baseCopy(value, [], []); | ||
}; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -20,6 +23,6 @@ * Makes a comparator function out of a function that reports whether the first element is less than the second. | ||
*/ | ||
module.exports = function comparator(pred) { | ||
module.exports = _curry1(function comparator(pred) { | ||
return function(a, b) { | ||
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | ||
}; | ||
}; | ||
}); |
var _concat = require('./internal/_concat'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _hasMethod = require('./internal/_hasMethod'); | ||
var _isArray = require('./internal/_isArray'); | ||
var op = require('./op'); | ||
@@ -21,4 +21,2 @@ | ||
* and pass it the value of `list2`. | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* | ||
@@ -30,8 +28,4 @@ * @example | ||
* R.concat('ABC', 'DEF'); // 'ABCDEF' | ||
* | ||
* // operator-style: | ||
* R.concat(R.__)([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6] | ||
* | ||
*/ | ||
module.exports = op(function(set1, set2) { | ||
module.exports = _curry2(function(set1, set2) { | ||
if (_isArray(set2)) { | ||
@@ -38,0 +32,0 @@ return _concat(set1, set2); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var constructN = require('./constructN'); | ||
@@ -28,4 +29,4 @@ | ||
*/ | ||
module.exports = function construct(Fn) { | ||
module.exports = _curry1(function construct(Fn) { | ||
return constructN(Fn.length, Fn); | ||
}; | ||
}); |
var _contains = require('./internal/_contains'); | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -16,4 +16,2 @@ | ||
* @return {Boolean} `true` if the item is in the list, `false` otherwise. | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* | ||
@@ -27,7 +25,3 @@ * @example | ||
* R.contains(obj)([{}, obj, {}]); //=> true | ||
* | ||
* // operator-style | ||
* R.contains(R.__)([1, 2, 3], 3) //=> true | ||
* | ||
*/ | ||
module.exports = op(_contains); | ||
module.exports = _curry2(_contains); |
var _map = require('./internal/_map'); | ||
var _slice = require('./internal/_slice'); | ||
var curryN = require('./curryN'); | ||
@@ -31,3 +32,3 @@ | ||
*/ | ||
module.exports = function(after) { | ||
module.exports = curryN(3, function(after) { | ||
var fns = _slice(arguments, 1); | ||
@@ -40,2 +41,2 @@ return function() { | ||
}; | ||
}; | ||
}); |
var _curry2 = require('./internal/_curry2'); | ||
var has = require('./has'); | ||
var _has = require('./internal/_has'); | ||
@@ -32,5 +32,5 @@ | ||
var key = fn(list[idx]); | ||
counts[key] = (has(key, counts) ? counts[key] : 0) + 1; | ||
counts[key] = (_has(key, counts) ? counts[key] : 0) + 1; | ||
} | ||
return counts; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var curryN = require('./curryN'); | ||
@@ -5,7 +6,25 @@ | ||
/** | ||
* Creates a new version of `fn` that, when invoked, will return either: | ||
* - A new function ready to accept one or more of `fn`'s remaining arguments, if all of | ||
* `fn`'s expected arguments have not yet been provided | ||
* - `fn`'s result if all of its expected arguments have been provided | ||
* Returns a curried equivalent of the provided function. The curried | ||
* function has two unusual capabilities. First, its arguments needn't | ||
* be provided one at a time. If `f` is a ternary function and `g` is | ||
* `R.curry(f)`, the following are equivalent: | ||
* | ||
* - `g(1)(2)(3)` | ||
* - `g(1)(2, 3)` | ||
* - `g(1, 2)(3)` | ||
* - `g(1, 2, 3)` | ||
* | ||
* Secondly, the special placeholder value `R.__` may be used to specify | ||
* "gaps", allowing partial application of any combination of arguments, | ||
* regardless of their positions. If `g` is as above and `_` is `R.__`, | ||
* the following are equivalent: | ||
* | ||
* - `g(1, 2, 3)` | ||
* - `g(_, 2, 3)(1)` | ||
* - `g(_, _, 3)(1)(2)` | ||
* - `g(_, _, 3)(1, 2)` | ||
* - `g(_, 2)(1)(3)` | ||
* - `g(_, 2)(1, 3)` | ||
* - `g(_, 2)(_, 3)(1)` | ||
* | ||
* @func | ||
@@ -27,6 +46,6 @@ * @memberOf R | ||
* var g = f(3); | ||
* g(4);//=> 10 | ||
* g(4); //=> 10 | ||
*/ | ||
module.exports = function curry(fn) { | ||
module.exports = _curry1(function curry(fn) { | ||
return curryN(fn.length, fn); | ||
}; | ||
}); |
@@ -1,4 +0,4 @@ | ||
var _concat = require('./internal/_concat'); | ||
var __ = require('./__'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _slice = require('./internal/_slice'); | ||
var arity = require('./arity'); | ||
@@ -8,12 +8,25 @@ | ||
/** | ||
* Creates a new version of `fn` with given arity that, when invoked, | ||
* will return either: | ||
* - A new function ready to accept one or more of `fn`'s remaining arguments, if all of | ||
* `fn`'s expected arguments have not yet been provided | ||
* - `fn`'s result if all of its expected arguments have been provided | ||
* Returns a curried equivalent of the provided function, with the | ||
* specified arity. The curried function has two unusual capabilities. | ||
* First, its arguments needn't be provided one at a time. If `g` is | ||
* `R.curryN(3, f)`, the following are equivalent: | ||
* | ||
* This function is useful in place of `curry`, when the arity of the | ||
* function to curry cannot be determined from its signature, e.g. if it's | ||
* a variadic function. | ||
* - `g(1)(2)(3)` | ||
* - `g(1)(2, 3)` | ||
* - `g(1, 2)(3)` | ||
* - `g(1, 2, 3)` | ||
* | ||
* Secondly, the special placeholder value `R.__` may be used to specify | ||
* "gaps", allowing partial application of any combination of arguments, | ||
* regardless of their positions. If `g` is as above and `_` is `R.__`, | ||
* the following are equivalent: | ||
* | ||
* - `g(1, 2, 3)` | ||
* - `g(_, 2, 3)(1)` | ||
* - `g(_, _, 3)(1)(2)` | ||
* - `g(_, _, 3)(1, 2)` | ||
* - `g(_, 2)(1)(3)` | ||
* - `g(_, 2)(1, 3)` | ||
* - `g(_, 2)(_, 3)(1)` | ||
* | ||
* @func | ||
@@ -23,3 +36,3 @@ * @memberOf R | ||
* @sig Number -> (* -> a) -> (* -> a) | ||
* @param {Number} fnArity The arity for the returned function. | ||
* @param {Number} length The arity for the returned function. | ||
* @param {Function} fn The function to curry. | ||
@@ -37,16 +50,30 @@ * @return {Function} A new, curried function. | ||
* var g = f(3); | ||
* g(4);//=> 10 | ||
* g(4); //=> 10 | ||
*/ | ||
module.exports = _curry2(function curryN(length, fn) { | ||
return (function recurry(args) { | ||
return arity(Math.max(length - (args && args.length || 0), 0), function() { | ||
if (arguments.length === 0) { throw _noArgsException(); } | ||
var newArgs = _concat(args, arguments); | ||
if (newArgs.length >= length) { | ||
return fn.apply(this, newArgs); | ||
} else { | ||
return recurry(newArgs); | ||
return arity(length, function() { | ||
var n = arguments.length; | ||
var shortfall = length - n; | ||
var idx = n; | ||
while (idx--) { | ||
if (arguments[idx] === __) { | ||
shortfall += 1; | ||
} | ||
}); | ||
}([])); | ||
} | ||
if (shortfall <= 0) { | ||
return fn.apply(this, arguments); | ||
} else { | ||
var initialArgs = _slice(arguments); | ||
return curryN(shortfall, function() { | ||
var currentArgs = _slice(arguments); | ||
var combinedArgs = []; | ||
var idx = -1; | ||
while (++idx < n) { | ||
var val = initialArgs[idx]; | ||
combinedArgs[idx] = (val === __ ? currentArgs.shift() : val); | ||
} | ||
return fn.apply(this, combinedArgs.concat(currentArgs)); | ||
}); | ||
} | ||
}); | ||
}); |
var _curry2 = require('./internal/_curry2'); | ||
/** | ||
@@ -22,4 +23,4 @@ * Returns the second argument if it is not null or undefined. If it is null | ||
*/ | ||
module.exports = _curry2(function _defaultTo(d, v) { | ||
module.exports = _curry2(function defaultTo(d, v) { | ||
return v == null ? d : v; | ||
}); |
@@ -34,3 +34,3 @@ var _curry3 = require('./internal/_curry3'); | ||
if (!containsPred(first[idx], second) && !containsPred(first[idx], out)) { | ||
out[out.length] = first[idx]; | ||
out[idx] = first[idx]; | ||
} | ||
@@ -37,0 +37,0 @@ } |
var _curry2 = require('./internal/_curry2'); | ||
var _pickBy = require('./internal/_pickBy'); | ||
var _dissoc = require('./internal/_dissoc'); | ||
@@ -19,4 +19,2 @@ | ||
*/ | ||
module.exports = _curry2(function dissoc(prop, obj) { | ||
return _pickBy(function(val, key) { return key !== prop; }, obj); | ||
}); | ||
module.exports = _curry2(_dissoc); |
@@ -1,2 +0,2 @@ | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -14,4 +14,2 @@ | ||
* @return {Number} The result of `a / b`. | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `undefined` for its first argument. | ||
* @example | ||
@@ -27,2 +25,2 @@ * | ||
*/ | ||
module.exports = op(function divide(a, b) { return a / b; }); | ||
module.exports = _curry2(function divide(a, b) { return a / b; }); |
@@ -21,3 +21,3 @@ var _checkForMethod = require('./internal/_checkForMethod'); | ||
module.exports = _curry2(_checkForMethod('drop', function drop(n, list) { | ||
return (n < list.length) ? _slice(list, n) : []; | ||
return n < list.length ? _slice(list, n) : []; | ||
})); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _hasMethod = require('./internal/_hasMethod'); | ||
@@ -17,4 +18,4 @@ | ||
*/ | ||
module.exports = function empty(x) { | ||
return (_hasMethod('empty', x)) ? x.empty() : []; | ||
}; | ||
module.exports = _curry1(function empty(x) { | ||
return _hasMethod('empty', x) ? x.empty() : []; | ||
}); |
var _curry2 = require('./internal/_curry2'); | ||
var _eqDeep = require('./internal/_eqDeep'); | ||
/** | ||
@@ -5,0 +6,0 @@ * Performs a deep test on whether two items are equal. |
@@ -5,2 +5,3 @@ var _curry2 = require('./internal/_curry2'); | ||
/** | ||
@@ -7,0 +8,0 @@ * Creates a new object by evolving a shallow copy of `object`, according to the |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _makeFlat = require('./internal/_makeFlat'); | ||
@@ -19,2 +20,2 @@ | ||
*/ | ||
module.exports = _makeFlat(true); | ||
module.exports = _curry1(_makeFlat(true)); |
@@ -1,4 +0,4 @@ | ||
var _concat = require('./internal/_concat'); | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _curry1 = require('./internal/_curry1'); | ||
var _slice = require('./internal/_slice'); | ||
var curry = require('./curry'); | ||
@@ -26,10 +26,9 @@ | ||
*/ | ||
module.exports = function flip(fn) { | ||
return function(a, b) { | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: return function(b) { return fn.apply(this, [b, a].concat(_slice(arguments, 1))); }; | ||
default: return fn.apply(this, _concat([b, a], _slice(arguments, 2))); | ||
} | ||
}; | ||
}; | ||
module.exports = _curry1(function flip(fn) { | ||
return curry(function(a, b) { | ||
var args = _slice(arguments); | ||
args[0] = b; | ||
args[1] = a; | ||
return fn.apply(this, args); | ||
}); | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _isArray = require('./internal/_isArray'); | ||
@@ -17,3 +18,3 @@ | ||
*/ | ||
module.exports = function fromPairs(pairs) { | ||
module.exports = _curry1(function fromPairs(pairs) { | ||
var idx = -1, len = pairs.length, out = {}; | ||
@@ -26,2 +27,2 @@ while (++idx < len) { | ||
return out; | ||
}; | ||
}); |
@@ -1,3 +0,3 @@ | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _slice = require('./internal/_slice'); | ||
var curry = require('./curry'); | ||
@@ -24,8 +24,4 @@ | ||
*/ | ||
module.exports = function func(funcName, obj) { | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: return function(obj) { return obj[funcName].apply(obj, _slice(arguments, 1)); }; | ||
default: return obj[funcName].apply(obj, _slice(arguments, 2)); | ||
} | ||
}; | ||
module.exports = curry(function func(funcName, obj) { | ||
return obj[funcName].apply(obj, _slice(arguments, 2)); | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _functionsWith = require('./internal/_functionsWith'); | ||
@@ -23,2 +24,2 @@ var keys = require('./keys'); | ||
*/ | ||
module.exports = _functionsWith(keys); | ||
module.exports = _curry1(_functionsWith(keys)); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _functionsWith = require('./internal/_functionsWith'); | ||
@@ -24,2 +25,2 @@ var keysIn = require('./keysIn'); | ||
*/ | ||
module.exports = _functionsWith(keysIn); | ||
module.exports = _curry1(_functionsWith(keysIn)); |
@@ -5,2 +5,3 @@ var prop = require('./prop'); | ||
/** | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -7,0 +8,0 @@ * @memberOf R |
@@ -22,4 +22,6 @@ var _append = require('./internal/_append'); | ||
* var score = student.score; | ||
* return (score < 65) ? 'F' : (score < 70) ? 'D' : | ||
* (score < 80) ? 'C' : (score < 90) ? 'B' : 'A'; | ||
* return score < 65 ? 'F' : | ||
* score < 70 ? 'D' : | ||
* score < 80 ? 'C' : | ||
* score < 90 ? 'B' : 'A'; | ||
* }); | ||
@@ -26,0 +28,0 @@ * var students = [{name: 'Abby', score: 84}, |
@@ -0,3 +1,3 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
var _gt = require('./internal/_gt'); | ||
var op = require('./op'); | ||
@@ -15,4 +15,2 @@ | ||
* @return {Boolean} a > b | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `undefined` for its first argument. | ||
* @example | ||
@@ -26,2 +24,2 @@ * | ||
*/ | ||
module.exports = op(_gt); | ||
module.exports = _curry2(_gt); |
@@ -1,2 +0,2 @@ | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -14,3 +14,2 @@ | ||
* @return {Boolean} a >= b | ||
* @note Operator: this is right-curried by default, but can be called via sections | ||
* @example | ||
@@ -23,4 +22,3 @@ * | ||
* R.gte(2)(0); //=> true | ||
* R.gte(R.__)(1, 2); //=> true | ||
*/ | ||
module.exports = op(function gte(a, b) { return a >= b; }); | ||
module.exports = _curry2(function gte(a, b) { return a >= b; }); |
var _curry2 = require('./internal/_curry2'); | ||
var _has = require('./internal/_has'); | ||
@@ -17,13 +18,13 @@ | ||
* | ||
* var obj = { | ||
* foo: 1, | ||
* bar: 2, | ||
* }; | ||
* R.has('foo', obj); //=> true | ||
* var hasName = R.has('name'); | ||
* hasName({name: 'alice'}); //=> true | ||
* hasName({name: 'bob'}); //=> true | ||
* hasName({}); //=> false | ||
* | ||
* var list = [{foo: 1}, {foo: 2}, {bar: 3}]; | ||
* R.filter(R.has('foo'), list); //=> [{foo: 1}, {foo: 2}] | ||
* var point = {x: 0, y: 0}; | ||
* var pointHas = R.has(R.__, point); | ||
* pointHas('x'); //=> true | ||
* pointHas('y'); //=> true | ||
* pointHas('z'); //=> false | ||
*/ | ||
module.exports = _curry2(function(prop, obj) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
}); | ||
module.exports = _curry2(_has); |
@@ -12,3 +12,3 @@ var nth = require('./nth'); | ||
* @sig [a] -> a | ||
* @param {Array} [list=[]] The array to consider. | ||
* @param {Array} list The array to consider. | ||
* @return {*} The first element of the list, or `undefined` if the list is empty. | ||
@@ -15,0 +15,0 @@ * @example |
@@ -5,2 +5,3 @@ var identity = require('./identity'); | ||
/** | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -7,0 +8,0 @@ * @memberOf R |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -18,4 +21,2 @@ * A function that does nothing but return the parameter supplied to it. Good as a default | ||
*/ | ||
module.exports = function identity(x) { | ||
return x; | ||
}; | ||
module.exports = _curry1(function identity(x) { return x; }); |
@@ -11,3 +11,3 @@ var slice = require('./slice'); | ||
* @sig [a] -> [a] | ||
* @param {Array} [list=[]] The array to consider. | ||
* @param {Array} list The array to consider. | ||
* @return {Array} A new array containing all but the last element of the input list, or an | ||
@@ -14,0 +14,0 @@ * empty list if the input list is empty. |
/* global R */ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _extend = require('./internal/_extend'); | ||
@@ -12,2 +13,3 @@ | ||
* | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -25,4 +27,4 @@ * @memberOf R | ||
*/ | ||
module.exports = function(obj) { | ||
module.exports = _curry1(function(obj) { | ||
return _extend(obj, R); | ||
}; | ||
}); |
@@ -22,4 +22,4 @@ var type = require('../type'); | ||
} | ||
refFrom[refFrom.length] = value; | ||
refTo[refTo.length] = copiedValue; | ||
refFrom[idx + 1] = value; | ||
refTo[idx + 1] = copiedValue; | ||
for (var key in value) { | ||
@@ -26,0 +26,0 @@ copiedValue[key] = _baseCopy(value[key], refFrom, refTo); |
var _isArray = require('./_isArray'); | ||
var _slice = require('./_slice'); | ||
@@ -15,13 +16,12 @@ | ||
module.exports = function _checkForMethod(methodname, fn) { | ||
return function(a, b, c) { | ||
return function() { | ||
var length = arguments.length; | ||
var obj = arguments[length - 1], | ||
callBound = obj && !_isArray(obj) && typeof obj[methodname] === 'function'; | ||
switch (arguments.length) { | ||
case 0: return fn(); | ||
case 1: return callBound ? obj[methodname]() : fn(a); | ||
case 2: return callBound ? obj[methodname](a) : fn(a, b); | ||
case 3: return callBound ? obj[methodname](a, b) : fn(a, b, c); | ||
if (length === 0) { | ||
return fn(); | ||
} | ||
var obj = arguments[length - 1]; | ||
return (_isArray(obj) || typeof obj[methodname] !== 'function') ? | ||
fn.apply(this, arguments) : | ||
obj[methodname].apply(obj, _slice(arguments, 0, length - 1)); | ||
}; | ||
}; |
@@ -18,13 +18,13 @@ /** | ||
var len2 = set2.length; | ||
var result = new Array(len1 + len2); | ||
var result = []; | ||
idx = -1; | ||
while (++idx < len1) { | ||
result[idx] = set1[idx]; | ||
result[result.length] = set1[idx]; | ||
} | ||
idx = -1; | ||
while (++idx < len2) { | ||
result[len1 + idx] = set2[idx]; | ||
result[result.length] = set2[idx]; | ||
} | ||
return result; | ||
}; |
@@ -1,2 +0,1 @@ | ||
var _noArgsException = require('./_noArgsException'); | ||
var arity = require('../arity'); | ||
@@ -11,13 +10,10 @@ | ||
return function() { | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: return arguments[0]; | ||
default: | ||
var idx = arguments.length - 1, fn = arguments[idx], length = fn.length; | ||
while (idx--) { | ||
fn = composeFunction(arguments[idx], fn); | ||
} | ||
return arity(length, fn); | ||
var idx = arguments.length - 1; | ||
var fn = arguments[idx]; | ||
var length = fn.length; | ||
while (idx--) { | ||
fn = composeFunction(arguments[idx], fn); | ||
} | ||
return arity(length, fn); | ||
}; | ||
}; |
@@ -1,7 +0,7 @@ | ||
var _noArgsException = require('./_noArgsException'); | ||
var _curry1 = require('./_curry1'); | ||
/** | ||
* Create a function which takes a a list | ||
* and determines the winning value by a compatator. Used internally | ||
* Create a function which takes a list | ||
* and determines the winning value by a comparator. Used internally | ||
* by `R.max` and `R.min` | ||
@@ -16,6 +16,3 @@ * | ||
module.exports = function _createMaxMin(comparator, initialVal) { | ||
return function(list) { | ||
if (arguments.length === 0) { | ||
throw _noArgsException(); | ||
} | ||
return _curry1(function(list) { | ||
var idx = -1, winner = initialVal, computed; | ||
@@ -29,3 +26,3 @@ while (++idx < list.length) { | ||
return winner; | ||
}; | ||
}); | ||
}; |
@@ -1,2 +0,3 @@ | ||
var _noArgsException = require('./_noArgsException'); | ||
var __ = require('../__'); | ||
var _curry1 = require('./_curry1'); | ||
@@ -11,23 +12,22 @@ | ||
* @return {Function} The curried function. | ||
* @example | ||
* | ||
* var addTwo = function(a, b) { | ||
* return a + b; | ||
* }; | ||
* | ||
* var curriedAddTwo = _curry2(addTwo); | ||
*/ | ||
module.exports = function _curry2(fn) { | ||
return function(a, b) { | ||
switch (arguments.length) { | ||
case 0: | ||
throw _noArgsException(); | ||
case 1: | ||
return function(b) { | ||
return fn(a, b); | ||
}; | ||
default: | ||
return fn(a, b); | ||
return function f2(a, b) { | ||
var n = arguments.length; | ||
if (n === 0) { | ||
return f2; | ||
} else if (n === 1 && a === __) { | ||
return f2; | ||
} else if (n === 1) { | ||
return _curry1(function(b) { return fn(a, b); }); | ||
} else if (n === 2 && a === __ && b === __) { | ||
return f2; | ||
} else if (n === 2 && a === __) { | ||
return _curry1(function(a) { return fn(a, b); }); | ||
} else if (n === 2 && b === __) { | ||
return _curry1(function(b) { return fn(a, b); }); | ||
} else { | ||
return fn(a, b); | ||
} | ||
}; | ||
}; |
@@ -0,3 +1,4 @@ | ||
var __ = require('../__'); | ||
var _curry1 = require('./_curry1'); | ||
var _curry2 = require('./_curry2'); | ||
var _noArgsException = require('./_noArgsException'); | ||
@@ -12,27 +13,38 @@ | ||
* @return {Function} The curried function. | ||
* @example | ||
* | ||
* var addThree = function(a, b, c) { | ||
* return a + b + c; | ||
* }; | ||
* | ||
* var curriedAddThree = _curry3(addThree); | ||
*/ | ||
module.exports = function _curry3(fn) { | ||
return function(a, b, c) { | ||
switch (arguments.length) { | ||
case 0: | ||
throw _noArgsException(); | ||
case 1: | ||
return _curry2(function(b, c) { | ||
return fn(a, b, c); | ||
}); | ||
case 2: | ||
return function(c) { | ||
return fn(a, b, c); | ||
}; | ||
default: | ||
return fn(a, b, c); | ||
return function f3(a, b, c) { | ||
var n = arguments.length; | ||
if (n === 0) { | ||
return f3; | ||
} else if (n === 1 && a === __) { | ||
return f3; | ||
} else if (n === 1) { | ||
return _curry2(function(b, c) { return fn(a, b, c); }); | ||
} else if (n === 2 && a === __ && b === __) { | ||
return f3; | ||
} else if (n === 2 && a === __) { | ||
return _curry2(function(a, c) { return fn(a, b, c); }); | ||
} else if (n === 2 && b === __) { | ||
return _curry2(function(b, c) { return fn(a, b, c); }); | ||
} else if (n === 2) { | ||
return _curry1(function(c) { return fn(a, b, c); }); | ||
} else if (n === 3 && a === __ && b === __ && c === __) { | ||
return f3; | ||
} else if (n === 3 && a === __ && b === __) { | ||
return _curry2(function(a, b) { return fn(a, b, c); }); | ||
} else if (n === 3 && a === __ && c === __) { | ||
return _curry2(function(a, c) { return fn(a, b, c); }); | ||
} else if (n === 3 && b === __ && c === __) { | ||
return _curry2(function(b, c) { return fn(a, b, c); }); | ||
} else if (n === 3 && a === __) { | ||
return _curry1(function(a) { return fn(a, b, c); }); | ||
} else if (n === 3 && b === __) { | ||
return _curry1(function(b) { return fn(a, b, c); }); | ||
} else if (n === 3 && c === __) { | ||
return _curry1(function(c) { return fn(a, b, c); }); | ||
} else { | ||
return fn(a, b, c); | ||
} | ||
}; | ||
}; |
@@ -0,3 +1,3 @@ | ||
var _has = require('./_has'); | ||
var eq = require('../eq'); | ||
var has = require('../has'); | ||
var keys = require('../keys'); | ||
@@ -45,8 +45,8 @@ var type = require('../type'); | ||
stackA.push(a); | ||
stackB.push(b); | ||
stackA[stackA.length] = a; | ||
stackB[stackB.length] = b; | ||
idx = keysA.length; | ||
while (idx--) { | ||
var key = keysA[idx]; | ||
if (!has(key, b) || !_eqDeep(b[key], a[key], stackA, stackB)) { | ||
if (!_has(key, b) || !_eqDeep(b[key], a[key], stackA, stackB)) { | ||
return false; | ||
@@ -53,0 +53,0 @@ } |
@@ -15,3 +15,3 @@ var isArrayLike = require('../isArrayLike'); | ||
if (isArrayLike(list[idx])) { | ||
value = (recursive) ? flatt(list[idx]) : list[idx]; | ||
value = recursive ? flatt(list[idx]) : list[idx]; | ||
j = -1; | ||
@@ -18,0 +18,0 @@ jlen = value.length; |
module.exports = function _map(fn, list) { | ||
var idx = -1, len = list.length, result = new Array(len); | ||
var idx = -1, len = list.length, result = []; | ||
while (++idx < len) { | ||
@@ -4,0 +4,0 @@ result[idx] = fn(list[idx]); |
@@ -17,9 +17,11 @@ /** | ||
module.exports = function _path(paths, obj) { | ||
var idx = -1, length = paths.length, val; | ||
if (obj == null) { return; } | ||
val = obj; | ||
while (val != null && ++idx < length) { | ||
val = val[paths[idx]]; | ||
if (obj == null || paths.length === 0) { | ||
return; | ||
} else { | ||
var val = obj; | ||
for (var idx = 0, len = paths.length; idx < len && val != null; idx += 1) { | ||
val = val[paths[idx]]; | ||
} | ||
return val; | ||
} | ||
return val; | ||
}; |
@@ -1,4 +0,1 @@ | ||
var _noArgsException = require('./_noArgsException'); | ||
/** | ||
@@ -23,7 +20,6 @@ * An optimized, private array `slice` implementation. | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: return _slice(args, 0, args.length); | ||
case 2: return _slice(args, from, args.length); | ||
default: | ||
var length = Math.max(0, to - from), list = new Array(length), idx = -1; | ||
var length = Math.max(0, to - from), list = [], idx = -1; | ||
while (++idx < length) { | ||
@@ -30,0 +26,0 @@ list[idx] = args[from + idx]; |
@@ -1,4 +0,6 @@ | ||
var has = require('./has'); | ||
var _curry1 = require('./internal/_curry1'); | ||
var _has = require('./internal/_has'); | ||
var keys = require('./keys'); | ||
/** | ||
@@ -27,3 +29,3 @@ * Same as R.invertObj, however this accounts for objects | ||
*/ | ||
module.exports = function invert(obj) { | ||
module.exports = _curry1(function invert(obj) { | ||
var props = keys(obj); | ||
@@ -37,9 +39,6 @@ var len = props.length; | ||
var val = obj[key]; | ||
if (!has(val, out)) { | ||
out[val] = []; | ||
} | ||
out[val].push(key); | ||
var list = _has(val, out) ? out[val] : (out[val] = []); | ||
list[list.length] = key; | ||
} | ||
return out; | ||
}; | ||
}); |
@@ -0,3 +1,5 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var keys = require('./keys'); | ||
/** | ||
@@ -27,3 +29,3 @@ * Returns a new object with the keys of the given object | ||
*/ | ||
module.exports = function invertObj(obj) { | ||
module.exports = _curry1(function invertObj(obj) { | ||
var props = keys(obj); | ||
@@ -39,2 +41,2 @@ var len = props.length; | ||
return out; | ||
}; | ||
}); |
var _slice = require('./internal/_slice'); | ||
var curry = require('./curry'); | ||
var curryN = require('./curryN'); | ||
@@ -27,3 +28,3 @@ | ||
*/ | ||
module.exports = function invoker(arity, method) { | ||
module.exports = curry(function invoker(arity, method) { | ||
var initialArgs = _slice(arguments, 2); | ||
@@ -36,2 +37,2 @@ var len = arity - initialArgs.length; | ||
}); | ||
}; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _isArray = require('./internal/_isArray'); | ||
@@ -21,3 +22,3 @@ | ||
*/ | ||
module.exports = function isArrayLike(x) { | ||
module.exports = _curry1(function isArrayLike(x) { | ||
if (_isArray(x)) { return true; } | ||
@@ -33,2 +34,2 @@ if (!x) { return false; } | ||
return false; | ||
}; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -17,4 +20,4 @@ * Reports whether the list has zero elements. | ||
*/ | ||
module.exports = function isEmpty(list) { | ||
module.exports = _curry1(function isEmpty(list) { | ||
return Object(list).length === 0; | ||
}; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -17,2 +20,2 @@ * Checks if the input value is `null` or `undefined`. | ||
*/ | ||
module.exports = function isNil(x) { return x == null; }; | ||
module.exports = _curry1(function isNil(x) { return x == null; }); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _indexOf = require('./internal/_indexOf'); | ||
@@ -20,3 +21,3 @@ | ||
*/ | ||
module.exports = function isSet(list) { | ||
module.exports = _curry1(function isSet(list) { | ||
var len = list.length; | ||
@@ -30,2 +31,2 @@ var idx = -1; | ||
return true; | ||
}; | ||
}); |
var _contains = require('./internal/_contains'); | ||
var has = require('./has'); | ||
var _curry1 = require('./internal/_curry1'); | ||
var _has = require('./internal/_has'); | ||
@@ -27,3 +28,3 @@ | ||
return function keys(obj) { | ||
return _curry1(function keys(obj) { | ||
if (Object(obj) !== obj) { | ||
@@ -37,3 +38,3 @@ return []; | ||
for (prop in obj) { | ||
if (has(prop, obj)) { | ||
if (_has(prop, obj)) { | ||
ks[ks.length] = prop; | ||
@@ -46,3 +47,3 @@ } | ||
prop = nonEnumerableProps[nIdx]; | ||
if (has(prop, obj) && !_contains(prop, ks)) { | ||
if (_has(prop, obj) && !_contains(prop, ks)) { | ||
ks[ks.length] = prop; | ||
@@ -53,3 +54,3 @@ } | ||
return ks; | ||
}; | ||
}); | ||
}()); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -20,3 +23,3 @@ * Returns a list containing the names of all the | ||
*/ | ||
module.exports = function keysIn(obj) { | ||
module.exports = _curry1(function keysIn(obj) { | ||
var prop, ks = []; | ||
@@ -27,2 +30,2 @@ for (prop in obj) { | ||
return ks; | ||
}; | ||
}); |
@@ -11,3 +11,3 @@ var nth = require('./nth'); | ||
* @sig [a] -> a | ||
* @param {Array} [list=[]] The array to consider. | ||
* @param {Array} list The array to consider. | ||
* @return {*} The last element of the list, or `undefined` if the list is empty. | ||
@@ -14,0 +14,0 @@ * @example |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var is = require('./is'); | ||
@@ -18,4 +19,4 @@ | ||
*/ | ||
module.exports = function length(list) { | ||
module.exports = _curry1(function length(list) { | ||
return list != null && is(Number, list.length) ? list.length : NaN; | ||
}; | ||
}); |
@@ -18,3 +18,3 @@ var _curry2 = require('./internal/_curry2'); | ||
* @param {Function} get A function that gets a value by property name | ||
* @param {Function} set A function that gets a value by property name | ||
* @param {Function} set A function that sets a value by property name | ||
* @return {Function} the returned function has `set` and `map` properties that are | ||
@@ -21,0 +21,0 @@ * also curried functions. |
@@ -1,2 +0,2 @@ | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _curry1 = require('./internal/_curry1'); | ||
var liftN = require('./liftN'); | ||
@@ -18,3 +18,3 @@ | ||
* | ||
* var madd3 = R.lift(R.curryN(3, function(a, b, c) { | ||
* var madd3 = R.lift(R.curry(function(a, b, c) { | ||
* return a + b + c; | ||
@@ -24,3 +24,3 @@ * })); | ||
* | ||
* var madd5 = R.lift(R.curryN(5, function(a, b, c, d, e) { | ||
* var madd5 = R.lift(R.curry(function(a, b, c, d, e) { | ||
* return a + b + c + d + e; | ||
@@ -30,7 +30,4 @@ * })); | ||
*/ | ||
module.exports = function lift(fn) { | ||
if (arguments.length === 0) { | ||
throw _noArgsException(); | ||
} | ||
module.exports = _curry1(function lift(fn) { | ||
return liftN(fn.length, fn); | ||
}; | ||
}); |
var _ap = require('./internal/_ap'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _reduce = require('./internal/_reduce'); | ||
@@ -30,5 +29,2 @@ var _slice = require('./internal/_slice'); | ||
var lifted = curryN(arity, fn); | ||
if (arguments.length === 0) { | ||
throw _noArgsException(); | ||
} | ||
return curryN(arity, function() { | ||
@@ -35,0 +31,0 @@ return _reduce(_ap, map(lifted, arguments[0]), _slice(arguments, 1)); |
@@ -0,3 +1,3 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
var _lt = require('./internal/_lt'); | ||
var op = require('./op'); | ||
@@ -15,4 +15,2 @@ | ||
* @return {Boolean} a < b | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `undefined` for its first argument. | ||
* @example | ||
@@ -26,2 +24,2 @@ * | ||
*/ | ||
module.exports = op(_lt); | ||
module.exports = _curry2(_lt); |
@@ -1,2 +0,2 @@ | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -14,4 +14,2 @@ | ||
* @return {Boolean} a <= b | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* @example | ||
@@ -24,4 +22,3 @@ * | ||
* R.lte(2)(10); //=> true | ||
* R.lte(R.__)(5, 4) // => true | ||
*/ | ||
module.exports = op(function lte(a, b) { return a <= b; }); | ||
module.exports = _curry2(function lte(a, b) { return a <= b; }); |
@@ -29,3 +29,3 @@ var _curry3 = require('./internal/_curry3'); | ||
module.exports = _curry3(function mapAccum(fn, acc, list) { | ||
var idx = -1, len = list.length, result = new Array(len), tuple = [acc]; | ||
var idx = -1, len = list.length, result = [], tuple = [acc]; | ||
while (++idx < len) { | ||
@@ -32,0 +32,0 @@ tuple = fn(tuple[0], list[idx]); |
@@ -32,3 +32,3 @@ var _curry3 = require('./internal/_curry3'); | ||
module.exports = _curry3(function mapAccumRight(fn, acc, list) { | ||
var idx = list.length, len = list.length, result = new Array(len), tuple = [acc]; | ||
var idx = list.length, result = [], tuple = [acc]; | ||
while (idx--) { | ||
@@ -35,0 +35,0 @@ tuple = fn(tuple[0], list[idx]); |
@@ -31,3 +31,3 @@ var _curry2 = require('./internal/_curry2'); | ||
module.exports = _curry2(function mapIndexed(fn, list) { | ||
var idx = -1, len = list.length, result = new Array(len); | ||
var idx = -1, len = list.length, result = []; | ||
while (++idx < len) { | ||
@@ -34,0 +34,0 @@ result[idx] = fn(list[idx], idx, list); |
@@ -0,3 +1,3 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
var _isInteger = require('./internal/_isInteger'); | ||
var op = require('./op'); | ||
@@ -19,4 +19,2 @@ | ||
* @see R.moduloBy | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* @example | ||
@@ -40,3 +38,3 @@ * | ||
*/ | ||
module.exports = op(function mathMod(m, p) { | ||
module.exports = _curry2(function mathMod(m, p) { | ||
if (!_isInteger(m)) { return NaN; } | ||
@@ -43,0 +41,0 @@ if (!_isInteger(p) || p < 1) { return NaN; } |
@@ -0,3 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _has = require('./internal/_has'); | ||
var _map = require('./internal/_map'); | ||
var has = require('./has'); | ||
@@ -53,7 +54,7 @@ | ||
return function memoize(fn) { | ||
return _curry1(function memoize(fn) { | ||
var cache = {}; | ||
return function() { | ||
var key = serialize(arguments); | ||
if (!has(key, cache)) { | ||
if (!_has(key, cache)) { | ||
cache[key] = fn.apply(this, arguments); | ||
@@ -63,3 +64,3 @@ } | ||
}; | ||
}; | ||
}); | ||
}()); |
@@ -0,3 +1,3 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
var _extend = require('./internal/_extend'); | ||
var op = require('./op'); | ||
@@ -25,4 +25,4 @@ | ||
*/ | ||
module.exports = op(function merge(a, b) { | ||
module.exports = _curry2(function merge(a, b) { | ||
return _extend(_extend({}, a), b); | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var merge = require('./merge'); | ||
@@ -20,2 +21,4 @@ var reduce = require('./reduce'); | ||
*/ | ||
module.exports = reduce(merge, {}); | ||
module.exports = _curry1(function mergeAll(list) { | ||
return reduce(merge, {}, list); | ||
}); |
@@ -1,2 +0,2 @@ | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -16,4 +16,2 @@ | ||
* @return {Number} The result of `b % a`. | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* @see R.mathMod | ||
@@ -31,2 +29,2 @@ * @example | ||
*/ | ||
module.exports = op(function modulo(a, b) { return a % b; }); | ||
module.exports = _curry2(function modulo(a, b) { return a % b; }); |
@@ -0,1 +1,4 @@ | ||
var _curry2 = require('./internal/_curry2'); | ||
/** | ||
@@ -26,3 +29,3 @@ * Wraps a function of any arity (including nullary) in a function that accepts exactly `n` | ||
*/ | ||
module.exports = function(n, fn) { | ||
module.exports = _curry2(function(n, fn) { | ||
switch (n) { | ||
@@ -42,2 +45,2 @@ case 0: return function() {return fn.call(this);}; | ||
} | ||
}; | ||
}); |
@@ -1,2 +0,2 @@ | ||
var multiply = require('./multiply'); | ||
var _curry1 = require('./internal/_curry1'); | ||
@@ -17,2 +17,2 @@ | ||
*/ | ||
module.exports = multiply(-1); | ||
module.exports = _curry1(function negate(n) { return -n; }); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -18,4 +21,4 @@ * A function wrapping a call to the given function in a `!` operation. It will return `true` when the | ||
*/ | ||
module.exports = function not(f) { | ||
module.exports = _curry1(function not(f) { | ||
return function() {return !f.apply(this, arguments);}; | ||
}; | ||
}); |
@@ -12,3 +12,3 @@ var _curry2 = require('./internal/_curry2'); | ||
* @category List | ||
* @sig [a] -> a | ||
* @sig Number -> [a] -> a | ||
* @param {Number} idx | ||
@@ -15,0 +15,0 @@ * @param {Array} list |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _nth = require('./internal/_nth'); | ||
@@ -18,6 +19,6 @@ | ||
*/ | ||
module.exports = function nthArg(n) { | ||
module.exports = _curry1(function nthArg(n) { | ||
return function() { | ||
return _nth(n, arguments); | ||
}; | ||
}; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -18,2 +21,2 @@ * Returns a singleton array containing the value provided. | ||
*/ | ||
module.exports = function of(x) { return [x]; }; | ||
module.exports = _curry1(function of(x) { return [x]; }); |
@@ -1,4 +0,3 @@ | ||
var _contains = require('./internal/_contains'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _pickBy = require('./internal/_pickBy'); | ||
var _indexOf = require('./internal/_indexOf'); | ||
@@ -12,3 +11,3 @@ | ||
* @category Object | ||
* @sig [k] -> {k: v} -> {k: v} | ||
* @sig [String] -> {String: *} -> {String: *} | ||
* @param {Array} names an array of String property names to omit from the new object | ||
@@ -22,5 +21,9 @@ * @param {Object} obj The object to copy from | ||
module.exports = _curry2(function omit(names, obj) { | ||
return _pickBy(function(val, key) { | ||
return !_contains(key, names); | ||
}, obj); | ||
var result = {}; | ||
for (var prop in obj) { | ||
if (_indexOf(names, prop) < 0) { | ||
result[prop] = obj[prop]; | ||
} | ||
} | ||
return result; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -18,3 +21,3 @@ * Accepts a function `fn` and returns a function that guards invocation of `fn` such that | ||
*/ | ||
module.exports = function once(fn) { | ||
module.exports = _curry1(function once(fn) { | ||
var called = false, result; | ||
@@ -29,2 +32,2 @@ return function() { | ||
}; | ||
}; | ||
}); |
var _concat = require('./internal/_concat'); | ||
var _createPartialApplicator = require('./internal/_createPartialApplicator'); | ||
var curry = require('./curry'); | ||
@@ -31,2 +32,2 @@ | ||
*/ | ||
module.exports = _createPartialApplicator(_concat); | ||
module.exports = curry(_createPartialApplicator(_concat)); |
var _concat = require('./internal/_concat'); | ||
var _createPartialApplicator = require('./internal/_createPartialApplicator'); | ||
var curry = require('./curry'); | ||
var flip = require('./flip'); | ||
@@ -31,2 +32,2 @@ | ||
*/ | ||
module.exports = _createPartialApplicator(flip(_concat)); | ||
module.exports = curry(_createPartialApplicator(flip(_concat))); |
@@ -24,5 +24,6 @@ var _curry2 = require('./internal/_curry2'); | ||
return _reduce(function(acc, elt) { | ||
acc[pred(elt) ? 0 : 1].push(elt); | ||
var xs = acc[pred(elt) ? 0 : 1]; | ||
xs[xs.length] = elt; | ||
return acc; | ||
}, [[], []], list); | ||
}); |
@@ -1,6 +0,7 @@ | ||
var pathOn = require('./pathOn'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _path = require('./internal/_path'); | ||
/** | ||
* Retrieve a nested path on an object separated by periods | ||
* Retrieve the value at a given path. | ||
* | ||
@@ -10,9 +11,9 @@ * @func | ||
* @category Object | ||
* @sig String -> {*} -> * | ||
* @param {String} path The dot path to use. | ||
* @sig [String] -> {*} -> * | ||
* @param {Array} path The path to use. | ||
* @return {*} The data at `path`. | ||
* @example | ||
* | ||
* R.path('a.b', {a: {b: 2}}); //=> 2 | ||
* R.path(['a', 'b'], {a: {b: 2}}); //=> 2 | ||
*/ | ||
module.exports = pathOn('.'); | ||
module.exports = _curry2(_path); |
@@ -13,4 +13,4 @@ var _curry3 = require('./internal/_curry3'); | ||
* @category Relation | ||
* @sig String -> v -> {k: v} -> Boolean | ||
* @param {String} path The path of the nested property to use | ||
* @sig [String] -> * -> {String: *} -> Boolean | ||
* @param {Array} path The path of the nested property to use | ||
* @param {*} val The value to compare the nested property with | ||
@@ -25,8 +25,8 @@ * @param {Object} obj The object to check the nested property in | ||
* var user3 = { name: 'Bob' }; | ||
* var users = [ user1, user2, user3 ] | ||
* var isFamous = R.pathEq('address.zipCode', 90210); | ||
* var users = [ user1, user2, user3 ]; | ||
* var isFamous = R.pathEq(['address', 'zipCode'], 90210); | ||
* R.filter(isFamous, users); //=> [ user1 ] | ||
*/ | ||
module.exports = _curry3(function(path, val, obj) { | ||
return _path(path.split('.'), obj) === val; | ||
module.exports = _curry3(function pathEq(path, val, obj) { | ||
return _path(path, obj) === val; | ||
}); |
@@ -1,4 +0,3 @@ | ||
var _contains = require('./internal/_contains'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _pickBy = require('./internal/_pickBy'); | ||
var _indexOf = require('./internal/_indexOf'); | ||
@@ -13,3 +12,3 @@ | ||
* @category Object | ||
* @sig [k] -> {k: v} -> {k: v} | ||
* @sig [String] -> {String: *} -> {String: *} | ||
* @param {Array} names an array of String property names to copy onto a new object | ||
@@ -24,5 +23,9 @@ * @param {Object} obj The object to copy from | ||
module.exports = _curry2(function pick(names, obj) { | ||
return _pickBy(function(val, key) { | ||
return _contains(key, names); | ||
}, obj); | ||
var result = {}; | ||
for (var prop in obj) { | ||
if (_indexOf(names, prop) >= 0) { | ||
result[prop] = obj[prop]; | ||
} | ||
} | ||
return result; | ||
}); |
var _curry2 = require('./internal/_curry2'); | ||
var _pickBy = require('./internal/_pickBy'); | ||
@@ -24,2 +23,10 @@ | ||
*/ | ||
module.exports = _curry2(_pickBy); | ||
module.exports = _curry2(function pickBy(test, obj) { | ||
var result = {}; | ||
for (var prop in obj) { | ||
if (test(obj[prop], prop, obj)) { | ||
result[prop] = obj[prop]; | ||
} | ||
} | ||
return result; | ||
}); |
@@ -8,2 +8,3 @@ var _prepend = require('./internal/_prepend'); | ||
* | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -10,0 +11,0 @@ * @memberOf R |
@@ -1,2 +0,2 @@ | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -19,8 +19,2 @@ | ||
*/ | ||
module.exports = function prop(p, obj) { | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: return function _prop(obj) { return obj[p]; }; | ||
} | ||
return obj[p]; | ||
}; | ||
module.exports = _curry2(function prop(p, obj) { return obj[p]; }); |
@@ -9,2 +9,3 @@ var flip = require('./flip'); | ||
* | ||
* @deprecated since v0.11.0 | ||
* @func | ||
@@ -11,0 +12,0 @@ * @memberOf R |
var _curry3 = require('./internal/_curry3'); | ||
var has = require('./has'); | ||
var _has = require('./internal/_has'); | ||
@@ -13,7 +13,7 @@ | ||
* @category Object | ||
* @sig s -> v -> {s: x} -> x | v | ||
* @sig a -> String -> Object -> a | ||
* @param {*} val The default value. | ||
* @param {String} p The name of the property to return. | ||
* @param {*} val The default value. | ||
* @param {Object} obj The object to query. | ||
* @return {*} The value of given property or default value. | ||
* @return {*} The value of given property of the supplied object or the default value. | ||
* @example | ||
@@ -32,3 +32,3 @@ * | ||
module.exports = _curry3(function propOr(val, p, obj) { | ||
return has(p, obj) ? obj[p] : val; | ||
return _has(p, obj) ? obj[p] : val; | ||
}); |
@@ -24,3 +24,3 @@ var _curry2 = require('./internal/_curry2'); | ||
var len = ps.length, | ||
out = new Array(len), | ||
out = [], | ||
idx = -1; | ||
@@ -27,0 +27,0 @@ |
@@ -24,7 +24,8 @@ var _curry2 = require('./internal/_curry2'); | ||
} | ||
var idx = 0, result = new Array(Math.floor(to) - Math.ceil(from)); | ||
var idx = 0, result = []; | ||
while (from < to) { | ||
result[idx++] = from++; | ||
result[idx] = from++; | ||
idx += 1; | ||
} | ||
return result; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _slice = require('./internal/_slice'); | ||
@@ -21,4 +22,4 @@ | ||
*/ | ||
module.exports = function reverse(list) { | ||
module.exports = _curry1(function reverse(list) { | ||
return _slice(list).reverse(); | ||
}; | ||
}); |
@@ -22,4 +22,3 @@ var _curry3 = require('./internal/_curry3'); | ||
module.exports = _curry3(function scan(fn, acc, list) { | ||
var idx = 0, len = list.length + 1, result = new Array(len); | ||
result[idx] = acc; | ||
var idx = 0, len = list.length + 1, result = [acc]; | ||
while (++idx < len) { | ||
@@ -26,0 +25,0 @@ acc = fn(acc, list[idx - 1]); |
@@ -1,6 +0,8 @@ | ||
var invoker = require('./invoker'); | ||
var _checkForMethod = require('./internal/_checkForMethod'); | ||
var _curry3 = require('./internal/_curry3'); | ||
/** | ||
* Returns the elements from `xs` starting at `a` and ending at `b - 1`. | ||
* Returns a list containing the elements of `xs` from `fromIndex` (inclusive) | ||
* to `toIndex` (exclusive). | ||
* | ||
@@ -11,6 +13,6 @@ * @func | ||
* @sig Number -> Number -> [a] -> [a] | ||
* @param {Number} a The starting index. | ||
* @param {Number} b One more than the ending index. | ||
* @param {Number} fromIndex The start index (inclusive). | ||
* @param {Number} toIndex The end index (exclusive). | ||
* @param {Array} xs The list to take elements from. | ||
* @return {Array} The items from `a` to `b - 1` from `xs`. | ||
* @return {Array} The slice of `xs` from `fromIndex` to `toIndex`. | ||
* @example | ||
@@ -21,2 +23,4 @@ * | ||
*/ | ||
module.exports = invoker(2, 'slice'); | ||
module.exports = _curry3(_checkForMethod('slice', function slice(fromIndex, toIndex, xs) { | ||
return Array.prototype.slice.call(xs, fromIndex, toIndex); | ||
})); |
@@ -1,2 +0,2 @@ | ||
var op = require('./op'); | ||
var _curry2 = require('./internal/_curry2'); | ||
@@ -14,4 +14,2 @@ | ||
* @return {Number} The result of `a - b`. | ||
* @note Operator: Since this is a non-commutative infix operator converted to prefix, it can | ||
* be curried right by explicitly passing `R.__` for its first argument. | ||
* @example | ||
@@ -28,2 +26,2 @@ * | ||
*/ | ||
module.exports = op(function subtract(a, b) { return a - b; }); | ||
module.exports = _curry2(function subtract(a, b) { return a - b; }); |
@@ -13,3 +13,3 @@ var _checkForMethod = require('./internal/_checkForMethod'); | ||
* @sig [a] -> [a] | ||
* @param {Array} [list=[]] The array to consider. | ||
* @param {Array} list The array to consider. | ||
* @return {Array} A new array containing all but the first element of the input list, or an | ||
@@ -16,0 +16,0 @@ * empty list if the input list is empty. |
@@ -23,9 +23,10 @@ var _curry2 = require('./internal/_curry2'); | ||
module.exports = _curry2(function times(fn, n) { | ||
var list = new Array(Number(n)); | ||
var len = list.length; | ||
var idx = -1; | ||
while (++idx < len) { | ||
var len = Number(n); | ||
var list = new Array(len); | ||
var idx = 0; | ||
while (idx < len) { | ||
list[idx] = fn(idx); | ||
idx += 1; | ||
} | ||
return list; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _pairWith = require('./internal/_pairWith'); | ||
@@ -21,2 +22,2 @@ var keys = require('./keys'); | ||
*/ | ||
module.exports = _pairWith(keys); | ||
module.exports = _curry1(_pairWith(keys)); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _pairWith = require('./internal/_pairWith'); | ||
@@ -25,2 +26,2 @@ var keysIn = require('./keysIn'); | ||
*/ | ||
module.exports = _pairWith(keysIn); | ||
module.exports = _curry1(_pairWith(keysIn)); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -22,12 +25,12 @@ * Removes (strips) whitespace from both ends of the string. | ||
if (!hasProtoTrim || (ws.trim() || !zeroWidth.trim())) { | ||
return function trim(str) { | ||
return _curry1(function trim(str) { | ||
var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); | ||
var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); | ||
return str.replace(beginRx, '').replace(endRx, ''); | ||
}; | ||
}); | ||
} else { | ||
return function trim(str) { | ||
return _curry1(function trim(str) { | ||
return str.trim(); | ||
}; | ||
}); | ||
} | ||
}()); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -22,6 +25,6 @@ * Gives a single-word string description of the (native) type of a value, returning such | ||
*/ | ||
module.exports = function type(val) { | ||
module.exports = _curry1(function type(val) { | ||
return val === null ? 'Null' : | ||
val === undefined ? 'Undefined' : | ||
Object.prototype.toString.call(val).slice(8, -1); | ||
}; | ||
}); |
@@ -1,2 +0,2 @@ | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _curry1 = require('./internal/_curry1'); | ||
var _slice = require('./internal/_slice'); | ||
@@ -27,9 +27,6 @@ | ||
*/ | ||
module.exports = function unapply(fn) { | ||
if (arguments.length === 0) { | ||
throw _noArgsException(); | ||
} | ||
module.exports = _curry1(function unapply(fn) { | ||
return function() { | ||
return fn(_slice(arguments)); | ||
}; | ||
}; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var nAry = require('./nAry'); | ||
@@ -28,4 +29,4 @@ | ||
*/ | ||
module.exports = function unary(fn) { | ||
module.exports = _curry1(function unary(fn) { | ||
return nAry(1, fn); | ||
}; | ||
}); |
var _contains = require('./internal/_contains'); | ||
var _curry1 = require('./internal/_curry1'); | ||
@@ -21,3 +22,3 @@ | ||
*/ | ||
module.exports = function uniq(list) { | ||
module.exports = _curry1(function uniq(list) { | ||
var idx = -1, len = list.length; | ||
@@ -32,2 +33,2 @@ var result = [], item; | ||
return result; | ||
}; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var _makeFlat = require('./internal/_makeFlat'); | ||
@@ -19,2 +20,2 @@ | ||
*/ | ||
module.exports = _makeFlat(false); | ||
module.exports = _curry1(_makeFlat(false)); |
@@ -70,3 +70,3 @@ var _slice = require('./internal/_slice'); | ||
*/ | ||
module.exports = function useWith(fn /*, transformers */) { | ||
module.exports = curry(function useWith(fn /*, transformers */) { | ||
var transformers = _slice(arguments, 1); | ||
@@ -77,6 +77,6 @@ var tlen = transformers.length; | ||
while (++idx < tlen) { | ||
args[args.length] = transformers[idx](arguments[idx]); | ||
args[idx] = transformers[idx](arguments[idx]); | ||
} | ||
return fn.apply(this, args.concat(_slice(arguments, tlen))); | ||
})); | ||
}; | ||
}); |
@@ -0,1 +1,2 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
var keys = require('./keys'); | ||
@@ -19,6 +20,6 @@ | ||
*/ | ||
module.exports = function values(obj) { | ||
module.exports = _curry1(function values(obj) { | ||
var props = keys(obj); | ||
var len = props.length; | ||
var vals = new Array(len); | ||
var vals = []; | ||
var idx = -1; | ||
@@ -29,2 +30,2 @@ while (++idx < len) { | ||
return vals; | ||
}; | ||
}); |
@@ -0,1 +1,4 @@ | ||
var _curry1 = require('./internal/_curry1'); | ||
/** | ||
@@ -20,3 +23,3 @@ * Returns a list of all the properties, including prototype properties, | ||
*/ | ||
module.exports = function valuesIn(obj) { | ||
module.exports = _curry1(function valuesIn(obj) { | ||
var prop, vs = []; | ||
@@ -27,2 +30,2 @@ for (prop in obj) { | ||
return vs; | ||
}; | ||
}); |
@@ -1,2 +0,2 @@ | ||
var _noArgsException = require('./internal/_noArgsException'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var _satisfiesSpec = require('./internal/_satisfiesSpec'); | ||
@@ -38,3 +38,3 @@ var groupBy = require('./groupBy'); | ||
*/ | ||
module.exports = function where(spec, testObj) { | ||
module.exports = _curry2(function where(spec, testObj) { | ||
var parsedSpec = groupBy(function(key) { | ||
@@ -44,10 +44,3 @@ return typeof spec[key] === 'function' ? 'fn' : 'obj'; | ||
switch (arguments.length) { | ||
case 0: throw _noArgsException(); | ||
case 1: | ||
return function(testObj) { | ||
return _satisfiesSpec(spec, parsedSpec, testObj); | ||
}; | ||
} | ||
return _satisfiesSpec(spec, parsedSpec, testObj); | ||
}; | ||
}); |
var _concat = require('./internal/_concat'); | ||
var _curry2 = require('./internal/_curry2'); | ||
var curryN = require('./curryN'); | ||
@@ -31,6 +32,6 @@ | ||
*/ | ||
module.exports = function wrap(fn, wrapper) { | ||
module.exports = _curry2(function wrap(fn, wrapper) { | ||
return curryN(fn.length, function() { | ||
return wrapper.apply(this, _concat([fn], arguments)); | ||
}); | ||
}; | ||
}); |
@@ -25,3 +25,2 @@ var _curry2 = require('./internal/_curry2'); | ||
var jlen = b.length; | ||
// Better to push them all or to do `new Array(ilen * jlen)` and calculate indices? | ||
var result = []; | ||
@@ -28,0 +27,0 @@ while (++idx < ilen) { |
@@ -13,3 +13,3 @@ var _curry2 = require('./internal/_curry2'); | ||
* @category List | ||
* @sig a -> b -> [[a,b]] | ||
* @sig [a] -> [b] -> [[a,b]] | ||
* @param {Array} list1 The first array to consider. | ||
@@ -16,0 +16,0 @@ * @param {Array} list2 The second array to consider. |
@@ -10,3 +10,3 @@ var _curry2 = require('./internal/_curry2'); | ||
* @category List | ||
* @sig k -> v -> {k: v} | ||
* @sig [String] -> [*] -> {String: *} | ||
* @param {Array} keys The array that will be properties on the output object. | ||
@@ -13,0 +13,0 @@ * @param {Array} values The list of values on the output object. |
Sorry, the diff of this file is too big to display
259
453517
38
12324