mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
lodash: Add spaces to compiled / template strings. [jddalton]
Former-commit-id: e28bb94dfb8f315f62dd942765752739f30950dc
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
/** The Node filesystem module */
|
||||
var fs = require('fs');
|
||||
|
||||
/** Used to minify string literals embedded in compiled strings */
|
||||
/** Used to minify string values used by `iterationFactory` and its options */
|
||||
var compiledValues = [
|
||||
'arrays',
|
||||
'objects'
|
||||
@@ -114,6 +114,13 @@
|
||||
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
|
||||
source = source.replace(RegExp('\\.(' + iterationFactoryOptions.concat(propWhitelist).join('|') + ')\\b', 'g'), "['$1']");
|
||||
|
||||
// remove whitespace from string literals
|
||||
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
|
||||
return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |use strict|var |'\\n'|\\n|\s+/g, function(match) {
|
||||
return match == false || match == '\\n' ? '' : match;
|
||||
});
|
||||
});
|
||||
|
||||
// minify `sortBy` and `template` methods
|
||||
['sortBy', 'template'].forEach(function(methodName) {
|
||||
var properties = ['criteria', 'value'],
|
||||
@@ -125,9 +132,6 @@
|
||||
result = result.replace(RegExp("'" + property + "'", 'g'), "'" + minNames[index] + "'");
|
||||
});
|
||||
|
||||
// remove escaped newlines in strings
|
||||
result = result.replace(/\\n/g, '');
|
||||
|
||||
// replace with modified snippet
|
||||
source = source.replace(snippet, result);
|
||||
});
|
||||
@@ -186,9 +190,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// remove escaped newlines in strings
|
||||
result = result.replace(/\\n/g, '');
|
||||
|
||||
// replace with modified snippet
|
||||
source = source.replace(snippet, result);
|
||||
});
|
||||
|
||||
148
lodash.js
148
lodash.js
@@ -81,24 +81,26 @@
|
||||
/** Compilation options for `_.difference` */
|
||||
var differenceFactoryOptions = {
|
||||
'args': 'array',
|
||||
'top': 'var values=concat.apply([],slice.call(arguments,1))',
|
||||
'top': 'var values = concat.apply([], slice.call(arguments, 1))',
|
||||
'init': '[]',
|
||||
'inLoop': 'if(indexOf(values,array[index])<0)result.push(array[index])'
|
||||
'inLoop': 'if (indexOf(values, array[index]) < 0) result.push(array[index])'
|
||||
};
|
||||
|
||||
/** Compilation options for `_.every` */
|
||||
var everyFactoryOptions = {
|
||||
'init': 'true',
|
||||
'inLoop': 'if(!callback(collection[index],index,collection))return !result'
|
||||
'inLoop': 'if (!callback(collection[index], index, collection)) return !result'
|
||||
};
|
||||
|
||||
/** Compilation options for `_.extend` */
|
||||
var extendFactoryOptions = {
|
||||
'args': 'object',
|
||||
'init': 'object',
|
||||
'beforeLoop': 'for(var source,j=1,length=arguments.length;j<length;j++){\nsource=arguments[j]',
|
||||
'beforeLoop':
|
||||
'for (var source, j = 1, length = arguments.length; j < length; j++) {\n' +
|
||||
'source = arguments[j]',
|
||||
'loopExp': 'index in source',
|
||||
'inLoop': 'object[index]=source[index]',
|
||||
'inLoop': 'object[index] = source[index]',
|
||||
'useHas': false,
|
||||
'afterLoop': '}'
|
||||
};
|
||||
@@ -106,23 +108,27 @@
|
||||
/** Compilation options for `_.filter` */
|
||||
var filterFactoryOptions = {
|
||||
'init': '[]',
|
||||
'inLoop': 'callback(collection[index],index,collection)&&result.push(collection[index])'
|
||||
'inLoop': 'callback(collection[index], index, collection) && result.push(collection[index])'
|
||||
};
|
||||
|
||||
/** Compilation options for `_.forEach` */
|
||||
var forEachFactoryOptions = {
|
||||
'args': 'collection,callback,thisArg',
|
||||
'args': 'collection, callback, thisArg',
|
||||
'top':
|
||||
'if(!callback){\ncallback=identity\n}\n' +
|
||||
'else if(thisArg){\ncallback=bind(callback,thisArg)\n}',
|
||||
'if (!callback) {\n' +
|
||||
'callback = identity\n' +
|
||||
'}\n' +
|
||||
'else if (thisArg) {\n' +
|
||||
'callback = bind(callback, thisArg)\n' +
|
||||
'}',
|
||||
'init': 'collection',
|
||||
'inLoop': 'callback(collection[index],index,collection)'
|
||||
'inLoop': 'callback(collection[index], index, collection)'
|
||||
};
|
||||
|
||||
/** Compilation options for `_.keys` */
|
||||
var keysFactoryOptions = {
|
||||
'args': 'object',
|
||||
'top': 'if(object!==Object(object))throw TypeError()',
|
||||
'top': 'if (object !== Object(object)) throw TypeError()',
|
||||
'init': '[]',
|
||||
'inLoop': 'result.push(index)'
|
||||
};
|
||||
@@ -132,26 +138,31 @@
|
||||
'init': '',
|
||||
'exits': '[]',
|
||||
'beforeLoop': {
|
||||
'array': 'result=Array(length)',
|
||||
'object': 'result=[]'
|
||||
'array': 'result = Array(length)',
|
||||
'object': 'result = []'
|
||||
},
|
||||
'inLoop': {
|
||||
'array': 'result[index]=callback(collection[index],index,collection)',
|
||||
'object': 'result[result.length]=callback(collection[index],index,collection)'
|
||||
'array': 'result[index] = callback(collection[index], index, collection)',
|
||||
'object': 'result[result.length] = callback(collection[index], index, collection)'
|
||||
}
|
||||
};
|
||||
|
||||
/** Compilation options for `_.max` */
|
||||
var maxFactoryOptions = {
|
||||
'top':
|
||||
'var current,result=-Infinity,computed=result;\n' +
|
||||
'if(!callback){\n' +
|
||||
'if(isArray(collection)&&collection[0]===+collection[0])return Math.max.apply(Math,collection);\n' +
|
||||
'if(isEmpty(collection))return result;\n' +
|
||||
'}else if(thisArg)callback=bind(callback,thisArg)',
|
||||
'var current, computed = -Infinity, result = computed;\n' +
|
||||
'if (!callback) {\n' +
|
||||
'if (isArray(collection) && collection[0] === +collection[0])' +
|
||||
'return Math.max.apply(Math, collection);\n' +
|
||||
'if (isEmpty(collection))' +
|
||||
'return result\n' +
|
||||
'} else if (thisArg) callback = bind(callback, thisArg)',
|
||||
'inLoop':
|
||||
'current=callback?callback(collection[index],index,collection):collection[index];\n' +
|
||||
'if(current>=computed)computed=current,result=collection[index]'
|
||||
'current = callback' +
|
||||
'? callback(collection[index], index, collection)' +
|
||||
': collection[index];\n' +
|
||||
'if (current >= computed)' +
|
||||
'computed = current, result = collection[index]'
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -221,9 +232,9 @@
|
||||
var isEmpty = iterationFactory({
|
||||
'args': 'value',
|
||||
'iterate': 'objects',
|
||||
'top': 'var className=toString.call(value)',
|
||||
'top': 'var className = toString.call(value)',
|
||||
'init': 'true',
|
||||
'beforeLoop': 'if(className==arrayClass||className==stringClass)return !value.length',
|
||||
'beforeLoop': 'if (className == arrayClass || className == stringClass) return !value.length',
|
||||
'inLoop': 'return false'
|
||||
});
|
||||
|
||||
@@ -269,29 +280,30 @@
|
||||
useHas = options.useHas !== false;
|
||||
|
||||
// stings used to compile methods are minified during the build process
|
||||
return Function('arrayClass,bind,concat,funcClass,hasOwnProperty,identity,' +
|
||||
'indexOf,Infinity,isArray,isEmpty,Math,slice,stringClass,' +
|
||||
'toString,undefined',
|
||||
return Function('arrayClass, bind, concat, funcClass, hasOwnProperty, identity,' +
|
||||
'indexOf, Infinity, isArray, isEmpty, Math, slice, stringClass,' +
|
||||
'toString, undefined',
|
||||
// compile the function in strict mode
|
||||
'"use strict";' +
|
||||
// compile the arguments the function accepts
|
||||
'return function(' + args + '){\n' +
|
||||
'return function(' + args + ') {\n' +
|
||||
// add code to the top of the iteration method
|
||||
(options.top || '') + ';\n' +
|
||||
// assign the `result` variable an initial value
|
||||
('var index, result' + (init ? '=' + init : '')) + ';\n' +
|
||||
// exit early if the first argument, e.g. `collection`, is nullish
|
||||
'if(' + firstArg + '==undefined)return ' + (options.exits || 'result') + ';\n' +
|
||||
'if (' + firstArg + ' == undefined) return ' + (options.exits || 'result') + ';\n' +
|
||||
// the following branch is for iterating arrays and array-like objects
|
||||
(arrayBranch
|
||||
// initialize `length` and `index` variables
|
||||
? 'var length=' + firstArg + '.length;\nindex=-1;\n' +
|
||||
? 'var length = ' + firstArg + '.length;\n' +
|
||||
'index = -1;\n' +
|
||||
// check if the `collection` is array-like when there is an object iteration branch
|
||||
((objectBranch ? 'if(length===+length){\n' : '') +
|
||||
((objectBranch ? 'if (length === +length) {\n' : '') +
|
||||
// add code before the while-loop
|
||||
(array.beforeLoop || '') + ';\n' +
|
||||
// add a custom loop expression
|
||||
'while(' + (array.loopExp || '++index<length') + '){\n' +
|
||||
'while (' + (array.loopExp || '++index < length') + ') {\n' +
|
||||
// add code inside the while-loop
|
||||
array.inLoop +
|
||||
'\n}' +
|
||||
@@ -304,13 +316,13 @@
|
||||
// the following branch is for iterating an object's own/inherited properties
|
||||
(objectBranch
|
||||
// begin the else-statement when there is an array-like iteration branch
|
||||
? ((arrayBranch ? 'else{\n' : '') +
|
||||
? ((arrayBranch ? 'else {\n' : '') +
|
||||
// add code before the for-in loop
|
||||
(object.beforeLoop || '') + ';\n' +
|
||||
// add a custom loop expression
|
||||
'for(' + (object.loopExp || 'index in ' + firstArg) + '){\n' +
|
||||
'for (' + (object.loopExp || 'index in ' + firstArg) + ') {\n' +
|
||||
// compile in `hasOwnProperty` checks when `options.useHas` is not `false`
|
||||
(useHas ? 'if(hasOwnProperty.call(' + /\S+$/.exec(object.loopExp || firstArg)[0] + ',index)){\n' : '') +
|
||||
(useHas ? 'if (hasOwnProperty.call(' + /\S+$/.exec(object.loopExp || firstArg)[0] + ',index)) {\n' : '') +
|
||||
// add code inside the for-in loop
|
||||
object.inLoop +
|
||||
(useHas ? '\n}' : '') +
|
||||
@@ -364,9 +376,9 @@
|
||||
* // => true
|
||||
*/
|
||||
var contains = iterationFactory({
|
||||
'args': 'collection,target',
|
||||
'args': 'collection, target',
|
||||
'init': 'false',
|
||||
'inLoop': 'if(collection[index]===target)return true'
|
||||
'inLoop': 'if (collection[index] === target) return true'
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -431,7 +443,7 @@
|
||||
* // => 2
|
||||
*/
|
||||
var find = iterationFactory(forEachFactoryOptions, {
|
||||
'inLoop': 'if(callback(collection[index],index,collection))return collection[index]'
|
||||
'inLoop': 'if (callback(collection[index], index, collection)) return collection[index]'
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -483,11 +495,13 @@
|
||||
var groupBy = iterationFactory(forEachFactoryOptions, {
|
||||
'init': '{}',
|
||||
'beforeLoop':
|
||||
'var prop,isFunc=toString.call(callback)==funcClass;\n' +
|
||||
'if(isFunc&&thisArg)callback=bind(callback,thisArg)',
|
||||
'var prop, isFunc = toString.call(callback) == funcClass;\n' +
|
||||
'if (isFunc && thisArg) callback = bind(callback, thisArg)',
|
||||
'inLoop':
|
||||
'prop=isFunc?callback(collection[index],index,collection):collection[index][callback];\n' +
|
||||
'(result[prop]||(result[prop]=[])).push(collection[index])'
|
||||
'prop = isFunc' +
|
||||
'? callback(collection[index], index, collection)' +
|
||||
': collection[index][callback];\n' +
|
||||
'(result[prop] || (result[prop] = [])).push(collection[index])'
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -507,13 +521,13 @@
|
||||
* // => [[1, 5, 7], [1, 2, 3]]
|
||||
*/
|
||||
var invoke = iterationFactory(mapFactoryOptions, {
|
||||
'args': 'collection,methodName',
|
||||
'top': 'var args=slice.call(arguments,2),isFunc=toString.call(methodName)==funcClass',
|
||||
'args': 'collection, methodName',
|
||||
'top': 'var args = slice.call(arguments, 2), isFunc = toString.call(methodName) == funcClass',
|
||||
'inLoop': (function() {
|
||||
var value = '(isFunc?methodName:collection[index][methodName]).apply(collection[index],args)';
|
||||
var value = '(isFunc ? methodName : collection[index][methodName]).apply(collection[index], args)';
|
||||
return {
|
||||
'array': 'result[index]=' + value,
|
||||
'object': 'result[result.length]=' + value
|
||||
'array': 'result[index] = ' + value,
|
||||
'object': 'result[result.length] = ' + value
|
||||
};
|
||||
}())
|
||||
});
|
||||
@@ -614,10 +628,10 @@
|
||||
* // => ['moe', 'larry', 'curly']
|
||||
*/
|
||||
var pluck = iterationFactory(mapFactoryOptions, {
|
||||
'args': 'collection,property',
|
||||
'args': 'collection, property',
|
||||
'inLoop': {
|
||||
'array': 'result[index]=collection[index][property]',
|
||||
'object': 'result[result.length]=collection[index][property]'
|
||||
'array': 'result[index] = collection[index][property]',
|
||||
'object': 'result[result.length] = collection[index][property]'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -645,22 +659,22 @@
|
||||
*/
|
||||
var reduce = iterationFactory({
|
||||
'args':
|
||||
'collection,callback,accumulator,thisArg',
|
||||
'collection, callback, accumulator, thisArg',
|
||||
'top':
|
||||
'var initial=arguments.length>2;\n' +
|
||||
'if(thisArg)callback=bind(callback,thisArg)',
|
||||
'var initial = arguments.length > 2;\n' +
|
||||
'if (thisArg) callback = bind(callback, thisArg)',
|
||||
'init':
|
||||
'accumulator',
|
||||
'beforeLoop': {
|
||||
'array': 'if(!initial)result=collection[++index]'
|
||||
'array': 'if (!initial) result = collection[++index]'
|
||||
},
|
||||
'inLoop': {
|
||||
'array':
|
||||
'result=callback(result,collection[index],index,collection)',
|
||||
'result = callback(result, collection[index], index, collection)',
|
||||
'object':
|
||||
'result=initial\n' +
|
||||
'?callback(result,collection[index],index,collection)\n' +
|
||||
':(initial=true,collection[index])'
|
||||
'result = initial\n' +
|
||||
'? callback(result, collection[index], index, collection)\n' +
|
||||
': (initial = true, collection[index])'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -934,8 +948,8 @@
|
||||
var values = iterationFactory(mapFactoryOptions, {
|
||||
'args': 'collection',
|
||||
'inLoop': {
|
||||
'array': 'result[index]=collection[index]',
|
||||
'object': 'result[result.length]=collection[index]'
|
||||
'array': 'result[index] = collection[index]',
|
||||
'object': 'result[result.length] = collection[index]'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -958,7 +972,7 @@
|
||||
var compact = iterationFactory({
|
||||
'args': 'array',
|
||||
'init': '[]',
|
||||
'inLoop': 'if(array[index])result.push(array[index])'
|
||||
'inLoop': 'if (array[index]) result.push(array[index])'
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -1310,7 +1324,7 @@
|
||||
* // => [2, 3, 4]
|
||||
*/
|
||||
var without = iterationFactory(differenceFactoryOptions, {
|
||||
'top': 'var values=slice.call(arguments,1)',
|
||||
'top': 'var values = slice.call(arguments, 1)',
|
||||
'init': '[]'
|
||||
});
|
||||
|
||||
@@ -1722,7 +1736,7 @@
|
||||
* // => { 'flavor': 'chocolate', 'sprinkles': 'lots' }
|
||||
*/
|
||||
var defaults = iterationFactory(extendFactoryOptions, {
|
||||
'inLoop': 'if(object[index]==undefined)' + extendFactoryOptions.inLoop
|
||||
'inLoop': 'if (object[index] == undefined)' + extendFactoryOptions.inLoop
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -1760,7 +1774,7 @@
|
||||
var functions = iterationFactory(keysFactoryOptions, {
|
||||
'top': '',
|
||||
'useHas': false,
|
||||
'inLoop': 'if(toString.call(object[index])==funcClass)result.push(index)',
|
||||
'inLoop': 'if (toString.call(object[index]) == funcClass) result.push(index)',
|
||||
'returns': 'result.sort()'
|
||||
});
|
||||
|
||||
@@ -2505,11 +2519,11 @@
|
||||
|
||||
// if a variable is not specified, place data values in local scope
|
||||
if (!options.variable) {
|
||||
source = 'with(object||{}){\n' + source + '\n}\n';
|
||||
source = 'with (object || {}) {\n' + source + '\n}\n';
|
||||
}
|
||||
|
||||
source = 'var __t,__j=Array.prototype.join,__p="";' +
|
||||
'function print(){__p+=__j.call(arguments,"")}\n' +
|
||||
source = 'var __t, __j = Array.prototype.join, __p = "";' +
|
||||
'function print() { __p += __j.call(arguments, "") }\n' +
|
||||
source + 'return __p';
|
||||
|
||||
var render = Function(options.variable || 'object', '_', source);
|
||||
|
||||
18
lodash.min.js
vendored
18
lodash.min.js
vendored
@@ -3,24 +3,24 @@
|
||||
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
|
||||
*/
|
||||
;(function(q,h){"use strict";var n=!0,o=!1;function R(a){return"[object Arguments]"==k.call(a)}function i(a){return new p(a)}function p(a){this.o=a}function g(){for(var a,b=-1,c={},d={},e={},f=["d","j","g","a"];++b<arguments.length;)for(a in arguments[b])e[a]=arguments[b][a];for(;a=f.pop();)"object"==typeof e[a]?(c[a]=e[a].c,d[a]=e[a].k):c[a]=d[a]=e[a]||"";a=e.b;var b=/^[^,]+/.exec(a)[0],f=e.h,j=e.i,g=!("x"==a||"b"==j),j=!("c"==a||"a"==j),h=e.n!==o;return Function("d,e,j,m,n,o,q,r,t,u,y,D,F,I,J,l,K",'"use strict";return function('+
|
||||
a+"){"+(e.m||"")+";"+("var p, C"+(f?"="+f:""))+";if("+b+"==K)return "+(e.f||"C")+";"+(g?"var w="+b+".length;p=-1;"+((j?"if(w===+w){":"")+(c.d||"")+";while("+(c.j||"++p<w")+"){"+c.g+"}"+(c.a||"")+";"+(j?"}":"")):"")+(j?(g?"else{":"")+(d.d||"")+";for("+(d.j||"p in "+b)+"){"+(h?"if(n.call("+/\S+$/.exec(d.j||b)[0]+",p)){":"")+d.g+(h?"}":"")+"}"+(d.a||"")+";"+(g?"}":""):"")+(e.e||"")+";return "+(e.l||"C")+"}")(B,s,C,ba,r,S,D,Infinity,E,ca,Math,m,F,k,n,o)}function T(a){return a.replace(ua,function(a,c){return y[c]})}
|
||||
a+"){"+(e.m||"")+";"+("var p,C"+(f?"="+f:""))+";if("+b+"==K)return "+(e.f||"C")+";"+(g?"var w="+b+".length;p=-1;"+((j?"if(w===+w){":"")+(c.d||"")+";while("+(c.j||"++p<w")+"){"+c.g+"}"+(c.a||"")+";"+(j?"}":"")):"")+(j?(g?"else{":"")+(d.d||"")+";for("+(d.j||"p in "+b)+"){"+(h?"if(n.call("+/\S+$/.exec(d.j||b)[0]+",p)){":"")+d.g+(h?"}":"")+"}"+(d.a||"")+";"+(g?"}":""):"")+(e.e||"")+";return "+(e.l||"C")+"}")(B,s,C,ba,r,S,D,Infinity,E,ca,Math,m,F,k,n,o)}function T(a){return a.replace(ua,function(a,c){return y[c]})}
|
||||
function da(a,b,c,d){var e=2<arguments.length;if(a==h)return c;d&&(b=s(b,d));var f=a.length;if(f===+f){for(f&&!e&&(c=a[--f]);f--;)c=b(c,a[f],f,a);return c}var j=U(a);for((f=j.length)&&!e&&(c=a[j[--f]]);f--;)e=j[f],c=b(c,a[e],e,a);return c}function ea(a,b,c){var d=0,e=a.length;for(c||(c=S);d<e;){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d}function V(a,b,c){return b==h||c?a[0]:m.call(a,0,b)}function fa(a,b){if(b)return C.apply([],a);for(var c=-1,d=a.length,e=[];++c<d;)E(a[c])?G.apply(e,fa(a[c])):e.push(a[c]);
|
||||
return e}function D(a,b,c){var d;if(a==h)return-1;if(c)return c=ea(a,b),a[c]===b?c:-1;c=0;for(d=a.length;c<d;c++)if(a[c]===b)return c;return-1}function ga(a){var b=m.call(arguments,1);return W(H(a),function(a){return X(b,function(b){return-1<D(b,a)})})}function ha(a,b,c){var d=a.length;return b==h||c?a[d-1]:m.call(a,-b||d)}function ia(a,b,c){return m.call(a,b==h||c?1:b)}function H(a,b,c){var c=c?I(a,c):a,d=[];3>a.length&&(b=n);J(c,function(c,f,j){if(b?ha(c)!==f||!c.length:0>D(c,f))c.push(f),d.push(a[j]);
|
||||
return c},[]);return d}function s(a,b){var c=m.call(arguments,2),d=c.length;return function(){c.length=d;G.apply(c,arguments);return a.apply(b,c)}}function ja(a,b,c){var d;return function(){var e=arguments,f=this;c&&!d&&a.apply(f,e);va(d);d=K(function(){d=h;c||a.apply(f,e)},b)}}function Y(a,b,c){c||(c=[]);if(a===b)return 0!==a||1/a==1/b;if(a==h||b==h)return a===b;a.p&&(a=a.o);b.p&&(b=b.o);if(a.isEqual&&t(a.isEqual))return a.isEqual(b);if(b.isEqual&&t(b.isEqual))return b.isEqual(a);var d=k.call(a);
|
||||
if(d!=k.call(b))return o;switch(d){case F:return a==""+b;case L:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case ka:case la:return+a==+b;case ma:return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return o;for(var e=c.length;e--;)if(c[e]==a)return n;var e=n,f=0;c.push(a);if(d==B){if(f=a.length,e=f==b.length)for(;f--&&(e=f in a==f in b&&Y(a[f],b[f],c)););}else{if("constructor"in a!="constructor"in b||a.constructor!=
|
||||
b.constructor)return o;for(var j in a)if(r.call(a,j)&&(f++,!(e=r.call(b,j)&&Y(a[j],b[j],c))))break;if(e){for(j in b)if(r.call(b,j)&&!f--)break;e=!f}}c.pop();return e}function t(a){return k.call(a)==ba}function S(a){return a}function na(a){u(M(a),function(b){var c=i[b]=a[b];i.prototype[b]=function(){var a=[this.o];G.apply(a,arguments);a=c.apply(i,a);return this.p?(new p(a)).chain():a}})}var y={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"};(function(){for(var a in y)y[y[a]]=
|
||||
a})();var Z="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(q=global),exports),wa=0,xa=q._,ya=/\\|'|\r|\n|\t|\u2028|\u2029/g,$=/.^/,ua=/\\(\\|'|r|n|t|u2028|u2029)/g,B="[object Array]",ka="[object Boolean]",la="[object Date]",ba="[object Function]",L="[object Number]",ma="[object RegExp]",F="[object String]",z=Array.prototype,N=Object.prototype,C=z.concat,r=N.hasOwnProperty,G=z.push,m=z.slice,k=N.toString,za=q.isFinite,N=Object.keys,va=q.clearTimeout,K=
|
||||
q.setTimeout,O={b:"c",m:"var M=j.apply([],D.call(arguments,1))",h:"[]",g:"if(q(M,c[p])<0)C.push(c[p])"},v={h:"J",g:"if(!f(h[p],p,h))return !C"},aa={b:"x",h:"x",d:"for(var E,j=1,w=arguments.length;j<w;j++){E=arguments[j]",j:"p in E",g:"x[p]=E[p]",n:o,a:"}"},A={h:"[]",g:"f(h[p],p,h)&&C.push(h[p])"},l={b:"h,f,H",m:"if(!f){f=o}else if(H){f=e(f,H)}",h:"h",g:"f(h[p],p,h)"},oa={b:"x",m:"if(x!==Object(x))throw TypeError()",h:"[]",g:"C.push(p)"},w={h:"",f:"[]",d:{c:"C=Array(w)",k:"C=[]"},g:{c:"C[p]=f(h[p],p,h)",
|
||||
k:"C[C.length]=f(h[p],p,h)"}},x={m:"var k,C=-r,i=C;if(!f){if(t(h)&&h[0]===+h[0])return y.max.apply(y,h);if(u(h))return C;}else if(H)f=e(f,H)",g:"k=f?f(h[p],p,h):h[p];if(k>=i)i=k,C=h[p]"},E=Array.isArray||function(a){return k.call(a)==B},ca=g({b:"L",i:"b",m:"var g=I.call(L)",h:"J",d:"if(g==d||g==F)return !L.length",g:"return l"}),pa=g({b:"h,G",h:"l",g:"if(h[p]===G)return J"}),X=g(l,v),W=g(l,A),qa=g(l,{g:"if(f(h[p],p,h))return h[p]"}),u=g(l),Aa=g(l,{h:"{}",d:"var A,v=I.call(f)==m;if(v&&H)f=e(f,H)",
|
||||
g:"A=v?f(h[p],p,h):h[p][f];(C[A]||(C[A]=[])).push(h[p])"}),Ba=g(w,{b:"h,z",m:"var b=D.call(arguments,2),v=I.call(z)==m",g:{c:"C[p]=(v?z:h[p][z]).apply(h[p],b)",k:"C[C.length]=(v?z:h[p][z]).apply(h[p],b)"}}),I=g(l,w),ra=g(l,x),x=g(l,x,{m:x.m.replace("-","").replace("max","min"),g:x.g.replace(">=","<")}),P=g(w,{b:"h,B",g:{c:"C[p]=h[p][B]",k:"C[C.length]=h[p][B]"}}),J=g({b:"h,f,a,H",m:"var s=arguments.length>2;if(H)f=e(f,H)",h:"a",d:{c:"if(!s)C=h[++p]"},g:{c:"C=f(C,h[p],p,h)",k:"C=s?f(C,h[p],p,h):(s=J,h[p])"}}),
|
||||
A=g(l,A,{g:"!"+A.g}),v=g(l,v,{h:"l",g:v.g.replace("!","")}),sa=g(w,{b:"h",g:{c:"C[p]=h[p]",k:"C[C.length]=h[p]"}}),w=g({b:"c",h:"[]",g:"if(c[p])C.push(c[p])"}),l=g(O),O=g(O,{m:"var M=D.call(arguments,1)",h:"[]"}),ta=g(aa,{g:"if(x[p]==K)"+aa.g}),Q=g(aa),M=g(oa,{m:"",n:o,g:"if(I.call(x[p])==m)C.push(p)",l:"C.sort()"});R(arguments)||(R=function(a){return!(!a||!r.call(a,"callee"))});var U=N||g(oa);Q(i,{VERSION:"0.1.0",templateSettings:{escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},
|
||||
after:function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,arguments)}},bind:s,bindAll:function(a){var b=arguments,c=1;1==b.length&&(c=0,b=M(a));for(var d=b.length;c<d;c++)a[b[c]]=s(a[b[c]],a);return a},chain:function(a){return(new p(a)).chain()},clone:function(a){return a!==Object(a)?a:E(a)?a.slice():Q({},a)},compact:w,compose:function(){var a=arguments;return function(){for(var b=arguments,c=a.length;c--;)b=[a[c].apply(this,b)];return b[0]}},contains:pa,debounce:ja,defaults:ta,defer:function(a){var b=
|
||||
m.call(arguments,1);return K(function(){return a.apply(h,b)},1)},delay:function(a,b){var c=m.call(arguments,2);return K(function(){return a.apply(h,c)},b)},difference:l,escape:function(a){return(a+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},every:X,extend:Q,filter:W,find:qa,first:V,flatten:fa,forEach:u,functions:M,groupBy:Aa,has:function(a,b){return r.call(a,b)},identity:S,indexOf:D,initial:function(a,b,
|
||||
c){return m.call(a,0,-(b==h||c?1:b))},intersection:ga,invoke:Ba,isArguments:R,isArray:E,isBoolean:function(a){return a===n||a===o||k.call(a)==ka},isDate:function(a){return k.call(a)==la},isElement:function(a){return!!(a&&1==a.nodeType)},isEmpty:ca,isEqual:Y,isFinite:function(a){return za(a)&&k.call(a)==L},isFunction:t,isNaN:function(a){return k.call(a)==L&&a!=+a},isNull:function(a){return null===a},isNumber:function(a){return k.call(a)==L},isObject:function(a){return a===Object(a)},isRegExp:function(a){return k.call(a)==
|
||||
q.setTimeout,O={b:"c",m:"var M=j.apply([],D.call(arguments,1))",h:"[]",g:"if(q(M,c[p])<0)C.push(c[p])"},v={h:"J",g:"if(!f(h[p],p,h))return!C"},aa={b:"x",h:"x",d:"for(var E,j=1,w=arguments.length;j<w;j++){E=arguments[j]",j:"p in E",g:"x[p]=E[p]",n:o,a:"}"},A={h:"[]",g:"f(h[p],p,h)&&C.push(h[p])"},l={b:"h,f,H",m:"if(!f){f=o}else if(H){f=e(f,H)}",h:"h",g:"f(h[p],p,h)"},oa={b:"x",m:"if(x!==Object(x))throw TypeError()",h:"[]",g:"C.push(p)"},w={h:"",f:"[]",d:{c:"C=Array(w)",k:"C=[]"},g:{c:"C[p]=f(h[p],p,h)",
|
||||
k:"C[C.length]=f(h[p],p,h)"}},x={m:"var k,i=-r,C=i;if(!f){if(t(h)&&h[0]===+h[0])return y.max.apply(y,h);if(u(h))return C}else if(H)f=e(f,H)",g:"k=f?f(h[p],p,h):h[p];if(k>=i)i=k,C=h[p]"},E=Array.isArray||function(a){return k.call(a)==B},ca=g({b:"L",i:"b",m:"var g=I.call(L)",h:"J",d:"if(g==d||g==F)return!L.length",g:"return l"}),pa=g({b:"h,G",h:"l",g:"if(h[p]===G)return J"}),X=g(l,v),W=g(l,A),qa=g(l,{g:"if(f(h[p],p,h))return h[p]"}),u=g(l),Aa=g(l,{h:"{}",d:"var A,v=I.call(f)==m;if(v&&H)f=e(f,H)",g:"A=v?f(h[p],p,h):h[p][f];(C[A]||(C[A]=[])).push(h[p])"}),
|
||||
Ba=g(w,{b:"h,z",m:"var b=D.call(arguments,2),v=I.call(z)==m",g:{c:"C[p]=(v?z:h[p][z]).apply(h[p],b)",k:"C[C.length]=(v?z:h[p][z]).apply(h[p],b)"}}),I=g(l,w),ra=g(l,x),x=g(l,x,{m:x.m.replace("-","").replace("max","min"),g:x.g.replace(">=","<")}),P=g(w,{b:"h,B",g:{c:"C[p]=h[p][B]",k:"C[C.length]=h[p][B]"}}),J=g({b:"h,f,a,H",m:"var s=arguments.length>2;if(H)f=e(f,H)",h:"a",d:{c:"if(!s)C=h[++p]"},g:{c:"C=f(C,h[p],p,h)",k:"C=s?f(C,h[p],p,h):(s=J,h[p])"}}),A=g(l,A,{g:"!"+A.g}),v=g(l,v,{h:"l",g:v.g.replace("!",
|
||||
"")}),sa=g(w,{b:"h",g:{c:"C[p]=h[p]",k:"C[C.length]=h[p]"}}),w=g({b:"c",h:"[]",g:"if(c[p])C.push(c[p])"}),l=g(O),O=g(O,{m:"var M=D.call(arguments,1)",h:"[]"}),ta=g(aa,{g:"if(x[p]==K)"+aa.g}),Q=g(aa),M=g(oa,{m:"",n:o,g:"if(I.call(x[p])==m)C.push(p)",l:"C.sort()"});R(arguments)||(R=function(a){return!(!a||!r.call(a,"callee"))});var U=N||g(oa);Q(i,{VERSION:"0.1.0",templateSettings:{escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},after:function(a,b){return 1>a?b():
|
||||
function(){if(1>--a)return b.apply(this,arguments)}},bind:s,bindAll:function(a){var b=arguments,c=1;1==b.length&&(c=0,b=M(a));for(var d=b.length;c<d;c++)a[b[c]]=s(a[b[c]],a);return a},chain:function(a){return(new p(a)).chain()},clone:function(a){return a!==Object(a)?a:E(a)?a.slice():Q({},a)},compact:w,compose:function(){var a=arguments;return function(){for(var b=arguments,c=a.length;c--;)b=[a[c].apply(this,b)];return b[0]}},contains:pa,debounce:ja,defaults:ta,defer:function(a){var b=m.call(arguments,
|
||||
1);return K(function(){return a.apply(h,b)},1)},delay:function(a,b){var c=m.call(arguments,2);return K(function(){return a.apply(h,c)},b)},difference:l,escape:function(a){return(a+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},every:X,extend:Q,filter:W,find:qa,first:V,flatten:fa,forEach:u,functions:M,groupBy:Aa,has:function(a,b){return r.call(a,b)},identity:S,indexOf:D,initial:function(a,b,c){return m.call(a,
|
||||
0,-(b==h||c?1:b))},intersection:ga,invoke:Ba,isArguments:R,isArray:E,isBoolean:function(a){return a===n||a===o||k.call(a)==ka},isDate:function(a){return k.call(a)==la},isElement:function(a){return!!(a&&1==a.nodeType)},isEmpty:ca,isEqual:Y,isFinite:function(a){return za(a)&&k.call(a)==L},isFunction:t,isNaN:function(a){return k.call(a)==L&&a!=+a},isNull:function(a){return null===a},isNumber:function(a){return k.call(a)==L},isObject:function(a){return a===Object(a)},isRegExp:function(a){return k.call(a)==
|
||||
ma},isString:function(a){return k.call(a)==F},isUndefined:function(a){return a===h},keys:U,last:ha,lastIndexOf:function(a,b){if(a==h)return-1;for(var c=a.length;c--;)if(a[c]===b)return c;return-1},map:I,max:ra,memoize:function(a,b){var c={};return function(){var d=b?b.apply(this,arguments):arguments[0];return r.call(c,d)?c[d]:c[d]=a.apply(this,arguments)}},min:x,mixin:na,noConflict:function(){q._=xa;return this},once:function(a){var b,c=o;return function(){if(c)return b;c=n;return b=a.apply(this,
|
||||
arguments)}},pick:function(a){for(var b,c=-1,d=C.apply([],m.call(arguments,1)),e=d.length,f={};++c<e;)b=d[c],b in a&&(f[b]=a[b]);return f},pluck:P,range:function(a,b,c){c||(c=1);2>arguments.length&&(b=a||0,a=0);for(var d=-1,e=Math.max(Math.ceil((b-a)/c),0),f=Array(e);++d<e;)f[d]=a,a+=c;return f},reduce:J,reduceRight:da,reject:A,rest:ia,result:function(a,b){if(a==h)return null;var c=a[b];return t(c)?a[b]():c},shuffle:function(a){var b,c=[];u(a,function(a,e){b=Math.floor(Math.random()*(e+1));c[e]=c[b];
|
||||
c[b]=a});return c},size:function(a){var b=k.call(a);return b==B||b==F?a.length:U(a).length},some:v,sortBy:function(a,b,c){if(t(b))c&&(b=s(b,c));else var d=b,b=function(a){return a[d]};return P(I(a,function(c,f){return{a:b(c,f,a),b:c}}).sort(function(a,b){var c=a.a,d=b.a;return c===h?1:d===h?-1:c<d?-1:c>d?1:0}),"b")},sortedIndex:ea,tap:function(a,b){b(a);return a},template:function(a,b,c){function d(a){return e.call(this,a,i)}c=ta(c||{},i.templateSettings);a="__p+='"+a.replace(ya,function(a){return"\\"+
|
||||
y[a]}).replace(c.escape||$,function(a,b){return"'+((__t=("+T(b)+"))==null?'':_['escape'](__t))+'"}).replace(c.interpolate||$,function(a,b){return"'+((__t=("+T(b)+"))==null?'':__t)+'"}).replace(c.evaluate||$,function(a,b){return"';"+T(b)+";__p+='"})+"';";c.variable||(a="with(object||{}){"+a+"}");var a='var __t,__j=Array.prototype.join,__p="";function print(){__p+=__j.call(arguments,"")}'+a+"return __p",e=Function(c.variable||"object","_",a);if(b)return e(b,i);d.source="function("+(c.variable||"object")+
|
||||
y[a]}).replace(c.escape||$,function(a,b){return"'+((__t=("+T(b)+"))==null?'':_['escape'](__t))+'"}).replace(c.interpolate||$,function(a,b){return"'+((__t=("+T(b)+"))==null?'':__t)+'"}).replace(c.evaluate||$,function(a,b){return"';"+T(b)+";__p+='"})+"';\n";c.variable||(a="with(object||{}){"+a+"}");var a='var __t,__j=Array.prototype.join,__p="";function print(){__p+=__j.call(arguments,"")}'+a+"return __p",e=Function(c.variable||"object","_",a);if(b)return e(b,i);d.source="function("+(c.variable||"object")+
|
||||
"){"+a+"}";return d},throttle:function(a,b){var c,d,e,f,g,i,k=ja(function(){d=g=o},b);return function(){c=arguments;f=this;i||(i=K(function(){i=h;d&&a.apply(f,c);k()},b));g?d=n:e=a.apply(f,c);k();g=n;return e}},times:function(a,b,c){c&&(b=s(b,c));for(c=0;c<a;c++)b(c)},toArray:function(a){if(!a)return[];if(t(a.toArray))return a.toArray();var b=a.length;return b===+b?m.call(a):sa(a)},union:function(){return H(C.apply([],arguments))},uniq:H,uniqueId:function(a){var b=wa++;return a?a+b:b},values:sa,without:O,
|
||||
wrap:function(a,b){return function(){var c=[a];G.apply(c,arguments);return b.apply(this,c)}},zip:function(){for(var a=-1,b=ra(P(arguments,"length")),c=Array(b);++a<b;)c[a]=P(arguments,a);return c},all:X,any:v,collect:I,detect:qa,each:u,foldl:J,foldr:da,head:V,include:pa,inject:J,intersect:ga,methods:M,select:W,tail:ia,take:V,unique:H});p.prototype=i.prototype;na(i);u("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=z[a];i.prototype[a]=function(){var a=this.o;b.apply(a,arguments);
|
||||
a.length===0&&delete a[0];return this.p?(new p(a)).chain():a}});u(["concat","join","slice"],function(a){var b=z[a];p.prototype[a]=function(){var a=b.apply(this.o,arguments);return this.p?(new p(a)).chain():a}});Q(p.prototype,{chain:function(){this.p=n;return this},value:function(){return this.o}});Z?"object"==typeof module&&module&&module.q==Z?(module.q=i)._=i:Z._=i:(q._=i,"function"==typeof define&&"object"==typeof define.amd&&define.amd&&define(function(){return i}))})(this);
|
||||
|
||||
Reference in New Issue
Block a user