Whitespace nits and cleanup.

This commit is contained in:
John-David Dalton
2015-01-15 00:35:16 -08:00
committed by jdalton
parent 6dfb2997cb
commit ba21718cb9

View File

@@ -2020,7 +2020,6 @@
*/ */
function baseEvery(collection, predicate) { function baseEvery(collection, predicate) {
var result = true; var result = true;
baseEach(collection, function(value, index, collection) { baseEach(collection, function(value, index, collection) {
result = !!predicate(value, index, collection); result = !!predicate(value, index, collection);
return result; return result;
@@ -2039,7 +2038,6 @@
*/ */
function baseFilter(collection, predicate) { function baseFilter(collection, predicate) {
var result = []; var result = [];
baseEach(collection, function(value, index, collection) { baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) { if (predicate(value, index, collection)) {
result.push(value); result.push(value);
@@ -2063,7 +2061,6 @@
*/ */
function baseFind(collection, predicate, eachFunc, retKey) { function baseFind(collection, predicate, eachFunc, retKey) {
var result; var result;
eachFunc(collection, function(value, key, collection) { eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) { if (predicate(value, key, collection)) {
result = retKey ? key : value; result = retKey ? key : value;
@@ -2094,8 +2091,8 @@
var value = array[index]; var value = array[index];
if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) {
// Recursively flatten arrays (susceptible to call stack limits).
if (isDeep) { if (isDeep) {
// Recursively flatten arrays (susceptible to call stack limits).
value = baseFlatten(value, isDeep, isStrict); value = baseFlatten(value, isDeep, isStrict);
} }
var valIndex = -1, var valIndex = -1,
@@ -2356,7 +2353,6 @@
stackA.push(object); stackA.push(object);
stackB.push(other); stackB.push(other);
// Recursively compare objects and arrays (susceptible to call stack limits).
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB); var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB);
stackA.pop(); stackA.pop();
@@ -2425,7 +2421,6 @@
*/ */
function baseMap(collection, iteratee) { function baseMap(collection, iteratee) {
var result = []; var result = [];
baseEach(collection, function(value, key, collection) { baseEach(collection, function(value, key, collection) {
result.push(iteratee(value, key, collection)); result.push(iteratee(value, key, collection));
}); });
@@ -2992,9 +2987,9 @@
*/ */
function createAggregator(setter, initializer) { function createAggregator(setter, initializer) {
return function(collection, iteratee, thisArg) { return function(collection, iteratee, thisArg) {
var result = initializer ? initializer() : {};
iteratee = getCallback(iteratee, thisArg, 3); iteratee = getCallback(iteratee, thisArg, 3);
var result = initializer ? initializer() : {};
if (isArray(collection)) { if (isArray(collection)) {
var index = -1, var index = -1,
length = collection.length; length = collection.length;
@@ -3390,6 +3385,7 @@
: customizer(arrValue, othValue, index); : customizer(arrValue, othValue, index);
} }
if (typeof result == 'undefined') { if (typeof result == 'undefined') {
// Recursively compare arrays (susceptible to call stack limits).
if (isWhere) { if (isWhere) {
var othIndex = othLength; var othIndex = othLength;
while (othIndex--) { while (othIndex--) {
@@ -3488,6 +3484,7 @@
: customizer(objValue, othValue, key); : customizer(objValue, othValue, key);
} }
if (typeof result == 'undefined') { if (typeof result == 'undefined') {
// Recursively compare objects (susceptible to call stack limits).
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB); result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB);
} }
} }
@@ -3874,7 +3871,6 @@
*/ */
function pickByCallback(object, predicate) { function pickByCallback(object, predicate) {
var result = {}; var result = {};
baseForIn(object, function(value, key, object) { baseForIn(object, function(value, key, object) {
if (predicate(value, key, object)) { if (predicate(value, key, object)) {
result[key] = value; result[key] = value;
@@ -4444,7 +4440,6 @@
*/ */
function findLastIndex(array, predicate, thisArg) { function findLastIndex(array, predicate, thisArg) {
var length = array ? array.length : 0; var length = array ? array.length : 0;
predicate = getCallback(predicate, thisArg, 3); predicate = getCallback(predicate, thisArg, 3);
while (length--) { while (length--) {
if (predicate(array[length], length, array)) { if (predicate(array[length], length, array)) {
@@ -5755,7 +5750,6 @@
*/ */
function filter(collection, predicate, thisArg) { function filter(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter; var func = isArray(collection) ? arrayFilter : baseFilter;
predicate = getCallback(predicate, thisArg, 3); predicate = getCallback(predicate, thisArg, 3);
return func(collection, predicate); return func(collection, predicate);
} }
@@ -6068,9 +6062,8 @@
* // => ['barney', 'fred'] * // => ['barney', 'fred']
*/ */
function map(collection, iteratee, thisArg) { function map(collection, iteratee, thisArg) {
iteratee = getCallback(iteratee, thisArg, 3);
var func = isArray(collection) ? arrayMap : baseMap; var func = isArray(collection) ? arrayMap : baseMap;
iteratee = getCallback(iteratee, thisArg, 3);
return func(collection, iteratee); return func(collection, iteratee);
} }
@@ -6336,7 +6329,6 @@
*/ */
function reject(collection, predicate, thisArg) { function reject(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter; var func = isArray(collection) ? arrayFilter : baseFilter;
predicate = getCallback(predicate, thisArg, 3); predicate = getCallback(predicate, thisArg, 3);
return func(collection, function(value, index, collection) { return func(collection, function(value, index, collection) {
return !predicate(value, index, collection); return !predicate(value, index, collection);
@@ -6521,15 +6513,14 @@
* // => ['barney', 'fred', 'pebbles'] * // => ['barney', 'fred', 'pebbles']
*/ */
function sortBy(collection, iteratee, thisArg) { function sortBy(collection, iteratee, thisArg) {
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
iteratee = null;
}
iteratee = getCallback(iteratee, thisArg, 3);
var index = -1, var index = -1,
length = collection ? collection.length : 0, length = collection ? collection.length : 0,
result = isLength(length) ? Array(length) : []; result = isLength(length) ? Array(length) : [];
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
iteratee = null;
}
iteratee = getCallback(iteratee, thisArg, 3);
baseEach(collection, function(value, key, collection) { baseEach(collection, function(value, key, collection) {
result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value };
}); });
@@ -8887,9 +8878,9 @@
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/ */
function mapValues(object, iteratee, thisArg) { function mapValues(object, iteratee, thisArg) {
var result = {};
iteratee = getCallback(iteratee, thisArg, 3); iteratee = getCallback(iteratee, thisArg, 3);
var result = {};
baseForOwn(object, function(value, key, object) { baseForOwn(object, function(value, key, object) {
result[key] = iteratee(value, key, object); result[key] = iteratee(value, key, object);
}); });
@@ -9118,9 +9109,9 @@
* // => { 'a': 3, 'b': 6, 'c': 9 } * // => { 'a': 3, 'b': 6, 'c': 9 }
*/ */
function transform(object, iteratee, accumulator, thisArg) { function transform(object, iteratee, accumulator, thisArg) {
var isArr = isArray(object) || isTypedArray(object);
iteratee = getCallback(iteratee, thisArg, 4); iteratee = getCallback(iteratee, thisArg, 4);
var isArr = isArray(object) || isTypedArray(object);
if (accumulator == null) { if (accumulator == null) {
if (isArr || isObject(object)) { if (isArr || isObject(object)) {
var Ctor = object.constructor; var Ctor = object.constructor;
@@ -10806,14 +10797,12 @@
var isFilter = index == LAZY_FILTER_FLAG; var isFilter = index == LAZY_FILTER_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
iteratee = getCallback(iteratee, thisArg, 3);
var result = this.clone(), var result = this.clone(),
filtered = result.filtered, filtered = result.filtered,
iteratees = result.iteratees || (result.iteratees = []); iteratees = result.iteratees || (result.iteratees = []);
result.filtered = filtered || isFilter || (index == LAZY_WHILE_FLAG && result.dir < 0); result.filtered = filtered || isFilter || (index == LAZY_WHILE_FLAG && result.dir < 0);
iteratees.push({ 'iteratee': iteratee, 'type': index }); iteratees.push({ 'iteratee': getCallback(iteratee, thisArg, 3), 'type': index });
return result; return result;
}; };
}); });
@@ -10875,12 +10864,11 @@
}); });
LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) { LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) {
iteratee = getCallback(iteratee, thisArg, 3);
var done, var done,
lastIndex, lastIndex,
isRight = this.dir < 0; isRight = this.dir < 0;
iteratee = getCallback(iteratee, thisArg, 3);
return this.filter(function(value, index, array) { return this.filter(function(value, index, array) {
done = done && (isRight ? index < lastIndex : index > lastIndex); done = done && (isRight ? index < lastIndex : index > lastIndex);
lastIndex = index; lastIndex = index;
@@ -10890,7 +10878,6 @@
LazyWrapper.prototype.reject = function(iteratee, thisArg) { LazyWrapper.prototype.reject = function(iteratee, thisArg) {
iteratee = getCallback(iteratee, thisArg, 3); iteratee = getCallback(iteratee, thisArg, 3);
return this.filter(function(value, index, array) { return this.filter(function(value, index, array) {
return !iteratee(value, index, array); return !iteratee(value, index, array);
}); });