|
|
|
!function(){"use strict";var e,t,n,r,o,i,a,u,s,c,l,f,d,m,p,g,h,v=function(e){return function(){return e}},V={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,arguments))}},constant:v,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var a=new Array(arguments.length-1),n=1;n<arguments.length;n++)a[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=a.concat(n);return i.apply(null,o)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:v(!1),always:v(!0)},y=V.never,b=V.always,C=function(){return x},x=(r={fold:function(e,t){return e()},is:y,isSome:y,isNone:b,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:C,ap:C,each:function(){},bind:C,flatten:C,exists:y,forall:b,filter:C,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:V.constant("none()")},Object.freeze&&Object.freeze(r),r),w=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:b,isNone:y,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return w(e(n))},ap:function(e){return e.fold(C,function(e){return w(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:x},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(y,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},A={some:w,none:C,from:function(e){return null===e||e===undefined?x:w(e)}},N=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},E={isString:N("string"),isObject:N("object"),isArray:N("array"),isNull:N("null"),isBoolean:N("boolean"),isUndefined:N("undefined"),isFunction:N("function"),isNumber:N("number")},S=(o=Array.prototype.indexOf)===undefined?function(e,t){return O(e,t)}:function(e,t){return o.call(e,t)},k=function(e,t){return-1<S(e,t)},T=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},R=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},B=function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)},_=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},D=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return A.some(n);return A.none()},O=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},P=Array.prototype.push,L=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);P.apply(t,e[n])}return t},I=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},M=Array.prototype.slice,F=E.isFunction(Array.from)?Array.from:function(e){return M.call(e)},H={map:T,each:R,eachr:B,partition:function(e,t){for(var n=[],r=[],o=0,i=e.length;o<i;o++){var a=e[o];(t(a,o,e)?n:r).push(a)}return{pass:n,fail:r}},filter:_,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),r=[],o=[],i=0,a=e.length;i<a;i++){var u=e[i],s=t(u);s!==n&&(r.push(o),o=[]),n=s,o.push(u)}return 0!==o.length&&r.push(o),r},indexOf:function(e,t){var n=S(e,t);return-1===n?A.none():A.some(n)},f
|