Remove extraneous spaces from non-minified builds.

Former-commit-id: ec8e18d00884cab96031c061ed32002f41edc0e5
This commit is contained in:
John-David Dalton
2013-03-03 23:29:54 -08:00
parent 41e401b05e
commit 87b1ac776f
4 changed files with 49 additions and 51 deletions

View File

@@ -576,6 +576,8 @@
return source return source
// remove pseudo private properties // remove pseudo private properties
.replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n') .replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n')
// remove extraneous whitespace
.replace(/^ *\n/gm, '\n')
// remove lines with just whitespace and semicolons // remove lines with just whitespace and semicolons
.replace(/^ *;\n/gm, '') .replace(/^ *;\n/gm, '')
// consolidate multiple newlines // consolidate multiple newlines

15
dist/lodash.compat.js vendored
View File

@@ -402,7 +402,7 @@
* @returns {String} Returns the interpolated text. * @returns {String} Returns the interpolated text.
*/ */
var iteratorTemplate = function(obj) { var iteratorTemplate = function(obj) {
var __p = 'var index, iterable = ' + var __p = 'var index, iterable = ' +
(obj.firstArg ) + (obj.firstArg ) +
', result = iterable;\nif (!iterable) return result;\n' + ', result = iterable;\nif (!iterable) return result;\n' +
@@ -423,11 +423,11 @@
(obj.loop ) + (obj.loop ) +
'\n }\n } else { '; '\n }\n } else { ';
} ; } ;
if (obj.hasEnumPrototype) { if (obj.hasEnumPrototype) {
__p += '\n var skipProto = typeof iterable == \'function\';\n '; __p += '\n var skipProto = typeof iterable == \'function\';\n ';
} ; } ;
if (obj.isKeysFast && obj.useHas) { if (obj.isKeysFast && obj.useHas) {
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n '; __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ';
if (obj.hasEnumPrototype) { if (obj.hasEnumPrototype) {
@@ -461,7 +461,7 @@
} ; } ;
__p += '\n } '; __p += '\n } ';
} ; } ;
if (obj.hasDontEnumBug) { if (obj.hasDontEnumBug) {
__p += '\n\n var ctor = iterable.constructor;\n '; __p += '\n\n var ctor = iterable.constructor;\n ';
for (var k = 0; k < 7; k++) { for (var k = 0; k < 7; k++) {
@@ -475,17 +475,16 @@
(obj.loop ) + (obj.loop ) +
'\n } '; '\n } ';
} ; } ;
} ; } ;
if (obj.arrays || obj.nonEnumArgs) { if (obj.arrays || obj.nonEnumArgs) {
__p += '\n}'; __p += '\n}';
} ; } ;
__p += __p +=
(obj.bottom ) + (obj.bottom ) +
';\nreturn result'; ';\nreturn result';
return __p return __p
}; };

9
dist/lodash.js vendored
View File

@@ -324,7 +324,7 @@
* @returns {String} Returns the interpolated text. * @returns {String} Returns the interpolated text.
*/ */
var iteratorTemplate = function(obj) { var iteratorTemplate = function(obj) {
var __p = 'var index, iterable = ' + var __p = 'var index, iterable = ' +
(obj.firstArg ) + (obj.firstArg ) +
', result = iterable;\nif (!iterable) return result;\n' + ', result = iterable;\nif (!iterable) return result;\n' +
@@ -337,7 +337,7 @@
(obj.loop ) + (obj.loop ) +
'\n }\n}\nelse { '; '\n }\n}\nelse { ';
} ; } ;
if (obj.isKeysFast && obj.useHas) { if (obj.isKeysFast && obj.useHas) {
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ' + __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ' +
(obj.loop ) + (obj.loop ) +
@@ -359,15 +359,14 @@
} ; } ;
__p += '\n } '; __p += '\n } ';
} ; } ;
if (obj.arrays) { if (obj.arrays) {
__p += '\n}'; __p += '\n}';
} ; } ;
__p += __p +=
(obj.bottom ) + (obj.bottom ) +
';\nreturn result'; ';\nreturn result';
return __p return __p
}; };

View File

@@ -551,7 +551,7 @@
if (!iterable) return result; if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result; if (!objectTypes[typeof iterable]) return result;
callback || (callback = identity); callback || (callback = identity);
for (index in iterable) { for (index in iterable) {
if (callback(iterable[index], index, collection) === indicatorObject) return result; if (callback(iterable[index], index, collection) === indicatorObject) return result;
} }
@@ -584,7 +584,7 @@
if (!iterable) return result; if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result; if (!objectTypes[typeof iterable]) return result;
callback || (callback = identity); callback || (callback = identity);
for (index in iterable) { for (index in iterable) {
if (hasOwnProperty.call(iterable, index)) { if (hasOwnProperty.call(iterable, index)) {
if (callback(iterable[index], index, collection) === indicatorObject) return result; if (callback(iterable[index], index, collection) === indicatorObject) return result;
@@ -1035,7 +1035,7 @@
} }
var type = typeof a, var type = typeof a,
otherType = typeof b; otherType = typeof b;
if (a === a && if (a === a &&
(!a || (type != 'function' && type != 'object')) && (!a || (type != 'function' && type != 'object')) &&
(!b || (otherType != 'function' && otherType != 'object'))) { (!b || (otherType != 'function' && otherType != 'object'))) {
@@ -1046,7 +1046,7 @@
} }
var className = toString.call(a), var className = toString.call(a),
otherClass = toString.call(b); otherClass = toString.call(b);
if (className != otherClass) { if (className != otherClass) {
return false; return false;
} }
@@ -1054,12 +1054,12 @@
case boolClass: case boolClass:
case dateClass: case dateClass:
return +a == +b; return +a == +b;
case numberClass: case numberClass:
return a != +a return a != +a
? b != +b ? b != +b
: (a == 0 ? (1 / a == 1 / b) : a == +b); : (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass: case regexpClass:
case stringClass: case stringClass:
return a == b + ''; return a == b + '';
@@ -1074,7 +1074,7 @@
} }
var ctorA = a.constructor, var ctorA = a.constructor,
ctorB = b.constructor; ctorB = b.constructor;
if (ctorA != ctorB && !( if (ctorA != ctorB && !(
isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorA) && ctorA instanceof ctorA &&
isFunction(ctorB) && ctorB instanceof ctorB isFunction(ctorB) && ctorB instanceof ctorB
@@ -1084,7 +1084,7 @@
} }
stackA || (stackA = []); stackA || (stackA = []);
stackB || (stackB = []); stackB || (stackB = []);
var length = stackA.length; var length = stackA.length;
while (length--) { while (length--) {
if (stackA[length] == a) { if (stackA[length] == a) {
@@ -1093,14 +1093,14 @@
} }
var result = true, var result = true,
size = 0; size = 0;
stackA.push(a); stackA.push(a);
stackB.push(b); stackB.push(b);
if (isArr) { if (isArr) {
size = b.length; size = b.length;
result = size == a.length; result = size == a.length;
if (result) { if (result) {
while (size--) { while (size--) {
if (!(result = isEqual(a[size], b[size], stackA, stackB))) { if (!(result = isEqual(a[size], b[size], stackA, stackB))) {
@@ -1116,7 +1116,7 @@
return !(result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB)) && indicatorObject; return !(result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB)) && indicatorObject;
} }
}); });
if (result) { if (result) {
forIn(a, function(value, key, a) { forIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) { if (hasOwnProperty.call(a, key)) {
@@ -1358,7 +1358,7 @@
function omit(object) { function omit(object) {
var props = concat.apply(arrayRef, arguments), var props = concat.apply(arrayRef, arguments),
result = {}; result = {};
forIn(object, function(value, key) { forIn(object, function(value, key) {
if (indexOf(props, key, 1) < 0) { if (indexOf(props, key, 1) < 0) {
result[key] = value; result[key] = value;
@@ -1424,7 +1424,7 @@
props = concat.apply(arrayRef, arguments), props = concat.apply(arrayRef, arguments),
length = props.length, length = props.length,
result = {}; result = {};
while (++index < length) { while (++index < length) {
var prop = props[index]; var prop = props[index];
if (prop in object) { if (prop in object) {
@@ -1730,7 +1730,7 @@
function findWhere(object, properties) { function findWhere(object, properties) {
return where(object, properties, true); return where(object, properties, true);
} }
/** /**
* Iterates over a `collection`, executing the `callback` for each element in * Iterates over a `collection`, executing the `callback` for each element in
* the `collection`. The `callback` is bound to `thisArg` and invoked with three * the `collection`. The `callback` is bound to `thisArg` and invoked with three
@@ -2471,7 +2471,7 @@
length = array.length, length = array.length,
flattened = concat.apply(arrayRef, arguments), flattened = concat.apply(arrayRef, arguments),
result = []; result = [];
while (++index < length) { while (++index < length) {
var value = array[index] var value = array[index]
if (indexOf(flattened, value, length) < 0) { if (indexOf(flattened, value, length) < 0) {
@@ -2604,7 +2604,7 @@
var index = -1, var index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
result = []; result = [];
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
if (isArray(value)) { if (isArray(value)) {
@@ -2754,7 +2754,7 @@
index = -1, index = -1,
length = array ? array.length : 0, length = array ? array.length : 0,
result = []; result = [];
outer: outer:
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
@@ -3137,7 +3137,7 @@
length = array ? array.length : 0, length = array ? array.length : 0,
result = [], result = [],
seen = result; seen = result;
if (typeof isSorted != 'boolean' && isSorted != null) { if (typeof isSorted != 'boolean' && isSorted != null) {
thisArg = callback; thisArg = callback;
callback = isSorted; callback = isSorted;
@@ -3150,7 +3150,7 @@
while (++index < length) { while (++index < length) {
var value = array[index], var value = array[index],
computed = callback ? callback(value, index, array) : value; computed = callback ? callback(value, index, array) : value;
if (isSorted if (isSorted
? !index || seen[seen.length - 1] !== computed ? !index || seen[seen.length - 1] !== computed
: indexOf(seen, computed) < 0 : indexOf(seen, computed) < 0
@@ -3183,7 +3183,7 @@
var index = -1, var index = -1,
length = array.length, length = array.length,
result = []; result = [];
while (++index < length) { while (++index < length) {
var value = array[index] var value = array[index]
if (indexOf(arguments, value, 1) < 0) { if (indexOf(arguments, value, 1) < 0) {
@@ -3760,11 +3760,11 @@
function mixin(object) { function mixin(object) {
forEach(functions(object), function(methodName) { forEach(functions(object), function(methodName) {
var func = lodash[methodName] = object[methodName]; var func = lodash[methodName] = object[methodName];
lodash.prototype[methodName] = function() { lodash.prototype[methodName] = function() {
var args = [this.__wrapped__]; var args = [this.__wrapped__];
push.apply(args, arguments); push.apply(args, arguments);
var result = func.apply(lodash, args); var result = func.apply(lodash, args);
if (this.__chain__) { if (this.__chain__) {
result = createWrapper(result); result = createWrapper(result);
@@ -3938,17 +3938,17 @@
function template(text, data, options) { function template(text, data, options) {
text || (text = ''); text || (text = '');
options = defaults({}, options, lodash.templateSettings); options = defaults({}, options, lodash.templateSettings);
var index = 0, var index = 0,
source = "__p += '", source = "__p += '",
variable = options.variable; variable = options.variable;
var reDelimiters = RegExp( var reDelimiters = RegExp(
(options.escape || reNoMatch).source + '|' + (options.escape || reNoMatch).source + '|' +
(options.interpolate || reNoMatch).source + '|' + (options.interpolate || reNoMatch).source + '|' +
(options.evaluate || reNoMatch).source + '|$' (options.evaluate || reNoMatch).source + '|$'
, 'g'); , 'g');
text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) { text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {
source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar); source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
if (escapeValue) { if (escapeValue) {
@@ -3963,7 +3963,7 @@
index = offset + match.length; index = offset + match.length;
return match; return match;
}); });
source += "';\n"; source += "';\n";
if (!variable) { if (!variable) {
variable = 'obj'; variable = 'obj';
@@ -3974,7 +3974,7 @@
"function print() { __p += __j.call(arguments, '') }\n" + "function print() { __p += __j.call(arguments, '') }\n" +
source + source +
'return __p\n}'; 'return __p\n}';
try { try {
var result = Function('_', 'return ' + source)(lodash); var result = Function('_', 'return ' + source)(lodash);
} catch(e) { } catch(e) {
@@ -4063,7 +4063,7 @@
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
* Creates a `lodash` object that wraps the given `value`. * Creates a `lodash` object that wraps the given `value`.
* *
@@ -4091,8 +4091,7 @@
value.__chain__ = true; value.__chain__ = true;
return value; return value;
} }
/** /**
* Invokes `interceptor` with the `value` as the first argument, and then * Invokes `interceptor` with the `value` as the first argument, and then
* returns `value`. The purpose of this method is to "tap into" a method chain, * returns `value`. The purpose of this method is to "tap into" a method chain,
@@ -4118,7 +4117,7 @@
interceptor(value); interceptor(value);
return value; return value;
} }
/** /**
* Enables method chaining on the wrapper object. * Enables method chaining on the wrapper object.
* *
@@ -4138,8 +4137,7 @@
this.__chain__ = true; this.__chain__ = true;
return this; return this;
} }
/** /**
* Produces the `toString` result of the wrapped value. * Produces the `toString` result of the wrapped value.
* *
@@ -4308,7 +4306,7 @@
* @type String * @type String
*/ */
lodash.VERSION = '1.0.1'; lodash.VERSION = '1.0.1';
// add functions to `lodash.prototype` // add functions to `lodash.prototype`
mixin(lodash); mixin(lodash);
@@ -4322,7 +4320,7 @@
lodash.prototype[methodName] = function() { lodash.prototype[methodName] = function() {
var value = this.__wrapped__; var value = this.__wrapped__;
func.apply(value, arguments); func.apply(value, arguments);
// avoid array-like object bugs with `Array#shift` and `Array#splice` // avoid array-like object bugs with `Array#shift` and `Array#splice`
// in Firefox < 10 and IE < 9 // in Firefox < 10 and IE < 9
if (hasObjectSpliceBug && value.length === 0) { if (hasObjectSpliceBug && value.length === 0) {
@@ -4331,14 +4329,14 @@
return this; return this;
}; };
}); });
// add `Array` accessor functions to the wrapper // add `Array` accessor functions to the wrapper
each(['concat', 'join', 'slice'], function(methodName) { each(['concat', 'join', 'slice'], function(methodName) {
var func = arrayRef[methodName]; var func = arrayRef[methodName];
lodash.prototype[methodName] = function() { lodash.prototype[methodName] = function() {
var value = this.__wrapped__, var value = this.__wrapped__,
result = func.apply(value, arguments); result = func.apply(value, arguments);
if (this.__chain__) { if (this.__chain__) {
result = new lodash(result); result = new lodash(result);
result.__chain__ = true; result.__chain__ = true;