-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathf_underscore-bundle-min.js
More file actions
45 lines (45 loc) · 16.6 KB
/
f_underscore-bundle-min.js
File metadata and controls
45 lines (45 loc) · 16.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Underscore.js 1.3.3
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
// f_underscore.js 0.2.1
// (c) 2012 Kris Jordan
// `f_underscore` is freely distributable under the MIT license.
// Documentation and details at:
// http://krisjordan.com/f_underscore
(function(){function b(a,f,j){if(a===f)return 0!==a||1/a==1/f;if(null==a||null==f)return a===f;a._chain&&(a=a._wrapped);f._chain&&(f=f._wrapped);if(a.isEqual&&c.isFunction(a.isEqual))return a.isEqual(f);if(f.isEqual&&c.isFunction(f.isEqual))return f.isEqual(a);var d=g.call(a);if(d!=g.call(f))return!1;switch(d){case "[object String]":return a==""+f;case "[object Number]":return a!=+a?f!=+f:0==a?1/a==1/f:a==+f;case "[object Date]":case "[object Boolean]":return+a==+f;case "[object RegExp]":return a.source==
f.source&&a.global==f.global&&a.multiline==f.multiline&&a.ignoreCase==f.ignoreCase}if("object"!=typeof a||"object"!=typeof f)return!1;for(var l=j.length;l--;)if(j[l]==a)return!0;j.push(a);var l=0,e=!0;if("[object Array]"==d){if(l=a.length,e=l==f.length)for(;l--&&(e=l in a==l in f&&b(a[l],f[l],j)););}else{if("constructor"in a!="constructor"in f||a.constructor!=f.constructor)return!1;for(var p in a)if(c.has(a,p)&&(l++,!(e=c.has(f,p)&&b(a[p],f[p],j))))break;if(e){for(p in f)if(c.has(f,p)&&!l--)break;
e=!l}}j.pop();return e}var h=this,s=h._,n={},i=Array.prototype,q=Object.prototype,d=i.slice,e=i.unshift,g=q.toString,m=q.hasOwnProperty,z=i.forEach,A=i.map,B=i.reduce,C=i.reduceRight,D=i.filter,E=i.every,F=i.some,t=i.indexOf,G=i.lastIndexOf,q=Array.isArray,J=Object.keys,u=Function.prototype.bind,c=function(a){return new o(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=c),exports._=c):h._=c;c.VERSION="1.3.3";var k=c.each=c.forEach=function(a,
f,j){if(a!=null)if(z&&a.forEach===z)a.forEach(f,j);else if(a.length===+a.length)for(var d=0,b=a.length;d<b;d++){if(d in a&&f.call(j,a[d],d,a)===n)break}else for(d in a)if(c.has(a,d)&&f.call(j,a[d],d,a)===n)break};c.map=c.collect=function(a,f,c){var d=[];if(a==null)return d;if(A&&a.map===A)return a.map(f,c);k(a,function(a,b,e){d[d.length]=f.call(c,a,b,e)});if(a.length===+a.length)d.length=a.length;return d};c.reduce=c.foldl=c.inject=function(a,f,j,d){var b=arguments.length>2;a==null&&(a=[]);if(B&&
a.reduce===B){d&&(f=c.bind(f,d));return b?a.reduce(f,j):a.reduce(f)}k(a,function(a,c,e){if(b)j=f.call(d,j,a,c,e);else{j=a;b=true}});if(!b)throw new TypeError("Reduce of empty array with no initial value");return j};c.reduceRight=c.foldr=function(a,f,j,d){var b=arguments.length>2;a==null&&(a=[]);if(C&&a.reduceRight===C){d&&(f=c.bind(f,d));return b?a.reduceRight(f,j):a.reduceRight(f)}var e=c.toArray(a).reverse();d&&!b&&(f=c.bind(f,d));return b?c.reduce(e,f,j,d):c.reduce(e,f)};c.find=c.detect=function(a,
f,c){var d;H(a,function(a,b,e){if(f.call(c,a,b,e)){d=a;return true}});return d};c.filter=c.select=function(a,f,c){var d=[];if(a==null)return d;if(D&&a.filter===D)return a.filter(f,c);k(a,function(a,b,e){f.call(c,a,b,e)&&(d[d.length]=a)});return d};c.reject=function(a,f,c){var d=[];if(a==null)return d;k(a,function(a,b,e){f.call(c,a,b,e)||(d[d.length]=a)});return d};c.every=c.all=function(a,f,c){var d=true;if(a==null)return d;if(E&&a.every===E)return a.every(f,c);k(a,function(a,b,e){if(!(d=d&&f.call(c,
a,b,e)))return n});return!!d};var H=c.some=c.any=function(a,f,d){f||(f=c.identity);var b=false;if(a==null)return b;if(F&&a.some===F)return a.some(f,d);k(a,function(a,c,e){if(b||(b=f.call(d,a,c,e)))return n});return!!b};c.include=c.contains=function(a,f){var c=false;if(a==null)return c;if(t&&a.indexOf===t)return a.indexOf(f)!=-1;return c=H(a,function(a){return a===f})};c.invoke=function(a,f){var j=d.call(arguments,2);return c.map(a,function(a){return(c.isFunction(f)?f||a:a[f]).apply(a,j)})};c.pluck=
function(a,f){return c.map(a,function(a){return a[f]})};c.max=function(a,f,d){if(!f&&c.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!f&&c.isEmpty(a))return-Infinity;var b={computed:-Infinity};k(a,function(a,c,e){c=f?f.call(d,a,c,e):a;c>=b.computed&&(b={value:a,computed:c})});return b.value};c.min=function(a,f,d){if(!f&&c.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!f&&c.isEmpty(a))return Infinity;var b={computed:Infinity};k(a,function(a,c,e){c=f?f.call(d,a,c,e):a;c<b.computed&&
(b={value:a,computed:c})});return b.value};c.shuffle=function(a){var c=[],d;k(a,function(a,b){d=Math.floor(Math.random()*(b+1));c[b]=c[d];c[d]=a});return c};c.sortBy=function(a,f,d){var b=c.isFunction(f)?f:function(a){return a[f]};return c.pluck(c.map(a,function(a,c,f){return{value:a,criteria:b.call(d,a,c,f)}}).sort(function(a,c){var f=a.criteria,d=c.criteria;return f===void 0?1:d===void 0?-1:f<d?-1:f>d?1:0}),"value")};c.groupBy=function(a,f){var d={},b=c.isFunction(f)?f:function(a){return a[f]};
k(a,function(a,c){var f=b(a,c);(d[f]||(d[f]=[])).push(a)});return d};c.sortedIndex=function(a,f,d){d||(d=c.identity);for(var b=0,e=a.length;b<e;){var g=b+e>>1;d(a[g])<d(f)?b=g+1:e=g}return b};c.toArray=function(a){return!a?[]:c.isArray(a)||c.isArguments(a)?d.call(a):a.toArray&&c.isFunction(a.toArray)?a.toArray():c.values(a)};c.size=function(a){return c.isArray(a)?a.length:c.keys(a).length};c.first=c.head=c.take=function(a,c,b){return c!=null&&!b?d.call(a,0,c):a[0]};c.initial=function(a,c,b){return d.call(a,
0,a.length-(c==null||b?1:c))};c.last=function(a,c,b){return c!=null&&!b?d.call(a,Math.max(a.length-c,0)):a[a.length-1]};c.rest=c.tail=function(a,c,b){return d.call(a,c==null||b?1:c)};c.compact=function(a){return c.filter(a,function(a){return!!a})};c.flatten=function(a,f){return c.reduce(a,function(a,d){if(c.isArray(d))return a.concat(f?d:c.flatten(d));a[a.length]=d;return a},[])};c.without=function(a){return c.difference(a,d.call(arguments,1))};c.uniq=c.unique=function(a,d,b){var b=b?c.map(a,b):a,
e=[];a.length<3&&(d=true);c.reduce(b,function(b,j,g){if(d?c.last(b)!==j||!b.length:!c.include(b,j)){b.push(j);e.push(a[g])}return b},[]);return e};c.union=function(){return c.uniq(c.flatten(arguments,true))};c.intersection=c.intersect=function(a){var f=d.call(arguments,1);return c.filter(c.uniq(a),function(a){return c.every(f,function(d){return c.indexOf(d,a)>=0})})};c.difference=function(a){var f=c.flatten(d.call(arguments,1),true);return c.filter(a,function(a){return!c.include(f,a)})};c.zip=function(){for(var a=
d.call(arguments),f=c.max(c.pluck(a,"length")),b=Array(f),e=0;e<f;e++)b[e]=c.pluck(a,""+e);return b};c.indexOf=function(a,d,b){if(a==null)return-1;var e;if(b){b=c.sortedIndex(a,d);return a[b]===d?b:-1}if(t&&a.indexOf===t)return a.indexOf(d);b=0;for(e=a.length;b<e;b++)if(b in a&&a[b]===d)return b;return-1};c.lastIndexOf=function(a,c){if(a==null)return-1;if(G&&a.lastIndexOf===G)return a.lastIndexOf(c);for(var d=a.length;d--;)if(d in a&&a[d]===c)return d;return-1};c.range=function(a,c,d){if(arguments.length<=
1){c=a||0;a=0}for(var d=arguments[2]||1,b=Math.max(Math.ceil((c-a)/d),0),e=0,g=Array(b);e<b;){g[e++]=a;a=a+d}return g};var I=function(){};c.bind=function(a,b){var e,g;if(a.bind===u&&u)return u.apply(a,d.call(arguments,1));if(!c.isFunction(a))throw new TypeError;g=d.call(arguments,2);return e=function(){if(!(this instanceof e))return a.apply(b,g.concat(d.call(arguments)));I.prototype=a.prototype;var c=new I,h=a.apply(c,g.concat(d.call(arguments)));return Object(h)===h?h:c}};c.bindAll=function(a){var b=
d.call(arguments,1);b.length==0&&(b=c.functions(a));k(b,function(d){a[d]=c.bind(a[d],a)});return a};c.memoize=function(a,d){var b={};d||(d=c.identity);return function(){var e=d.apply(this,arguments);return c.has(b,e)?b[e]:b[e]=a.apply(this,arguments)}};c.delay=function(a,c){var b=d.call(arguments,2);return setTimeout(function(){return a.apply(null,b)},c)};c.defer=function(a){return c.delay.apply(c,[a,1].concat(d.call(arguments,1)))};c.throttle=function(a,d){var b,e,g,h,m,k,i=c.debounce(function(){m=
h=false},d);return function(){b=this;e=arguments;g||(g=setTimeout(function(){g=null;m&&a.apply(b,e);i()},d));h?m=true:k=a.apply(b,e);i();h=true;return k}};c.debounce=function(a,c,d){var b;return function(){var e=this,g=arguments;d&&!b&&a.apply(e,g);clearTimeout(b);b=setTimeout(function(){b=null;d||a.apply(e,g)},c)}};c.once=function(a){var c=false,d;return function(){if(c)return d;c=true;return d=a.apply(this,arguments)}};c.wrap=function(a,c){return function(){var b=[a].concat(d.call(arguments,0));
return c.apply(this,b)}};c.compose=function(){var a=arguments;return function(){for(var c=arguments,d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};c.after=function(a,c){return a<=0?c():function(){if(--a<1)return c.apply(this,arguments)}};c.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var d=[],b;for(b in a)c.has(a,b)&&(d[d.length]=b);return d};c.values=function(a){return c.map(a,c.identity)};c.functions=c.methods=function(a){var d=[],b;for(b in a)c.isFunction(a[b])&&
d.push(b);return d.sort()};c.extend=function(a){k(d.call(arguments,1),function(c){for(var d in c)a[d]=c[d]});return a};c.pick=function(a){var b={};k(c.flatten(d.call(arguments,1)),function(c){c in a&&(b[c]=a[c])});return b};c.defaults=function(a){k(d.call(arguments,1),function(c){for(var d in c)a[d]==null&&(a[d]=c[d])});return a};c.clone=function(a){return!c.isObject(a)?a:c.isArray(a)?a.slice():c.extend({},a)};c.tap=function(a,c){c(a);return a};c.isEqual=function(a,c){return b(a,c,[])};c.isEmpty=
function(a){if(a==null)return true;if(c.isArray(a)||c.isString(a))return a.length===0;for(var d in a)if(c.has(a,d))return false;return true};c.isElement=function(a){return!!(a&&a.nodeType==1)};c.isArray=q||function(a){return g.call(a)=="[object Array]"};c.isObject=function(a){return a===Object(a)};c.isArguments=function(a){return g.call(a)=="[object Arguments]"};c.isArguments(arguments)||(c.isArguments=function(a){return!(!a||!c.has(a,"callee"))});c.isFunction=function(a){return g.call(a)=="[object Function]"};
c.isString=function(a){return g.call(a)=="[object String]"};c.isNumber=function(a){return g.call(a)=="[object Number]"};c.isFinite=function(a){return c.isNumber(a)&&isFinite(a)};c.isNaN=function(a){return a!==a};c.isBoolean=function(a){return a===true||a===false||g.call(a)=="[object Boolean]"};c.isDate=function(a){return g.call(a)=="[object Date]"};c.isRegExp=function(a){return g.call(a)=="[object RegExp]"};c.isNull=function(a){return a===null};c.isUndefined=function(a){return a===void 0};c.has=function(a,
c){return m.call(a,c)};c.noConflict=function(){h._=s;return this};c.identity=function(a){return a};c.times=function(a,c,d){for(var b=0;b<a;b++)c.call(d,b)};c.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};c.result=function(a,d){if(a==null)return null;var b=a[d];return c.isFunction(b)?b.call(a):b};c.mixin=function(a){k(c.functions(a),function(d){K(d,c[d]=a[d])})};var L=0;c.uniqueId=
function(a){var c=L++;return a?a+c:c};c.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var v=/.^/,r={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},w;for(w in r)r[r[w]]=w;var M=/\\|'|\r|\n|\t|\u2028|\u2029/g,N=/\\(\\|'|r|n|t|u2028|u2029)/g,x=function(a){return a.replace(N,function(a,c){return r[c]})};c.template=function(a,d,b){b=c.defaults(b||{},c.templateSettings);a="__p+='"+a.replace(M,function(a){return"\\"+r[a]}).replace(b.escape||
v,function(a,c){return"'+\n_.escape("+x(c)+")+\n'"}).replace(b.interpolate||v,function(a,c){return"'+\n("+x(c)+")+\n'"}).replace(b.evaluate||v,function(a,c){return"';\n"+x(c)+"\n;__p+='"})+"';\n";b.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(b.variable||"obj","_",a);if(d)return e(d,c);d=function(a){return e.call(this,a,c)};d.source="function("+(b.variable||"obj")+"){\n"+a+"}";return d};
c.chain=function(a){return c(a).chain()};var o=function(a){this._wrapped=a};c.prototype=o.prototype;var y=function(a,d){return d?c(a).chain():a},K=function(a,b){o.prototype[a]=function(){var a=d.call(arguments);e.call(a,this._wrapped);return y(b.apply(c,a),this._chain)}};c.mixin(c);k("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var c=i[a];o.prototype[a]=function(){var d=this._wrapped;c.apply(d,arguments);var b=d.length;(a=="shift"||a=="splice")&&b===0&&delete d[0];return y(d,
this._chain)}});k(["concat","join","slice"],function(a){var c=i[a];o.prototype[a]=function(){return y(c.apply(this._wrapped,arguments),this._chain)}});o.prototype.chain=function(){this._chain=true;return this};o.prototype.value=function(){return this._wrapped}}).call(this);
(function(){var b=function(d){return q(d)};if("undefined"!==typeof exports){var h=require("underscore");exports.f_=b}else this.f_=b,h=this._;b.VERSION="0.2.1";b.zipObject=function(d,b){var g=h.zip(d,b),m={};h.each(g,function(d){m[d[0]]=d[1]});return m};b.partial=function(d){var b=h.rest(arguments,1);return function(){return d.apply(this,b.concat([].slice.apply(arguments)))}};b.thread=function(){var d=arguments;h.isArray(d[0])&&(d=d[0]);return function(){for(var b=[].slice.apply(arguments),g=0;g<d.length;g++)b=
[d[g].apply(this,b)];return b[0]}};b.callFunction=function(d){return function(b){return b(d)}};b.functionize=function(d){return h.isFunction(d)?d:function(){return d}};b.get=function(d){return function(b){return b[d]}};b.getSet=function(d,b){return function(g){g[d]=b(g[d]);return g}};b.getByProperty=function(d){return function(b){return d[b]}};b.set=function(d,e){var g=b.functionize(e);return function(b){b[d]=g(b);return b}};b.setByProperty=function(d,e){var g=b.functionize(e);return function(b){d[b]=
g(d,b);return d}};b.project=function(d){return function(e){return b.zipObject(d,h.map(d,b.getByProperty(e)))}};b.unaryExpr=function(d,b){void 0===b&&(b=h.identity);return h.isFunction(b)?function(g){return d(b(g))}:function(){return d(b)}};b.binaryExpr=function(b,e,g){void 0===g&&(g=e,e=h.identity);return h.isFunction(e)?h.isFunction(g)?function(h){return b(e(h),g(h))}:function(h){return b(e(h),g)}:h.isFunction(g)?function(h){return b(e,g(h))}:function(){return b(e,g)}};b.ternaryExpr=function(d,e,
g,i){void 0===i&&(i=g,g=e,e=h.identity);e=b.functionize(e);g=b.functionize(g);i=b.functionize(i);return function(b){return d(e(b),g(b),i(b))}};b.methodExpr=function(d){var e=h.map(h.rest(arguments),b.functionize);return function(b){var i=h.map(e,function(d){return d(b)});b[d]||(b=h.first(i),i=h.rest(i));return b[d].apply(b,i)}};var s=h.isEqual;b.incr=b.increment=b.partial(b.unaryExpr,function(b){return b+1});b.decr=b.decrement=b.partial(b.unaryExpr,function(b){return b-1});b.sqr=b.square=b.partial(b.unaryExpr,
function(b){return b*b});b.not=b.partial(b.unaryExpr,function(b){return!b});b.neg=b.negate=b.partial(b.unaryExpr,function(b){return-1*b});b.add=b.partial(b.binaryExpr,function(b,e){return b+e});b.sub=b.subtract=b.partial(b.binaryExpr,function(b,e){return b-e});b.mul=b.multiply=b.partial(b.binaryExpr,function(b,e){return b*e});b.div=b.divide=b.partial(b.binaryExpr,function(b,e){return b/e});b.mod=b.modulo=b.partial(b.binaryExpr,function(b,e){return b%e});b.append=b.partial(b.binaryExpr,function(b,
e){return(""+b).concat(e)});b.prepend=b.partial(b.binaryExpr,function(b,e){return(""+e).concat(b)});b.eq=b.isEqual=b.partial(b.binaryExpr,s);b.neq=b.isNotEqual=b.partial(b.binaryExpr,function(){return!s.apply(this,arguments)});b.gt=b.greaterThan=b.partial(b.binaryExpr,function(b,e){return b>e});b.gte=b.atLeast=b.partial(b.binaryExpr,function(b,e){return b>=e});b.lt=b.lessThan=b.partial(b.binaryExpr,function(b,e){return b<e});b.lte=b.atMost=b.partial(b.binaryExpr,function(b,e){return b<=e});b.greaterOf=
b.partial(b.binaryExpr,function(b,e){return b>e?b:e});b.lesserOf=b.partial(b.binaryExpr,function(b,e){return b<e?b:e});b.and=b.partial(b.binaryExpr,function(b,e){return b&&e});b.neither=b.partial(b.binaryExpr,function(b,e){return!b&&!e});b.or=b.partial(b.binaryExpr,function(b,e){return b||e});b.xor=b.partial(b.binaryExpr,function(b,e){return b&&!e||!b&&e});b.ternary=b.partial(b.ternaryExpr,function(b,e,g){return b?e:g});var n="pop,push,reverse,shift,sort,splice,unshift,join,charAt,charCodeAt,fromCharCode,match,replace,search,split,substr,substring,toLowerCase,toUpperCase,concat,indexOf,lastIndexOf,slice".split(",");
h.extend(b,b.zipObject(n,h.map(n,function(d){return b.partial(b.methodExpr,d)})));var i={};h.each(h.functions(b),function(d){i[d]=function(){this._stack.push(b[d].apply(this,arguments));return this}});var q=function(d){var e=[];void 0!==d&&e.push(b.get(d));d=function(){return b.thread(e).apply(this,arguments)};d._stack=e;return h.extend(d,i)}}).call(this);