Avoid mixing boolean and object types in variable assignments.

This commit is contained in:
jdalton
2015-05-12 23:41:14 -07:00
parent 78cc98840b
commit 934b08f720

View File

@@ -749,7 +749,7 @@
stringProto = String.prototype;
/** Used to detect DOM support. */
var document = (document = context.window) && document.document;
var document = (document = context.window) ? document.document : null;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
@@ -776,20 +776,20 @@
);
/** Native method references. */
var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer,
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice,
var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) ? ArrayBuffer : null,
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) ? bufferSlice : null,
ceil = Math.ceil,
clearTimeout = context.clearTimeout,
floor = Math.floor,
getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) ? getPrototypeOf : null,
push = arrayProto.push,
preventExtensions = isNative(preventExtensions = Object.preventExtensions) && preventExtensions,
preventExtensions = isNative(preventExtensions = Object.preventExtensions) ? preventExtensions : null,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
Set = isNative(Set = context.Set) && Set,
Set = isNative(Set = context.Set) ? Set : null,
setTimeout = context.setTimeout,
splice = arrayProto.splice,
Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array,
WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap;
Uint8Array = isNative(Uint8Array = context.Uint8Array) ? Uint8Array : null,
WeakMap = isNative(WeakMap = context.WeakMap) ? WeakMap : null;
/** Used to clone array buffers. */
var Float64Array = (function() {
@@ -800,18 +800,18 @@
var func = isNative(func = context.Float64Array) && func,
result = new func(new ArrayBuffer(10), 0, 1) && func;
} catch(e) {}
return result;
return result || null;
}());
/* Native method references for those with the same name as other `lodash` methods. */
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
var nativeCreate = isNative(nativeCreate = Object.create) ? nativeCreate : null,
nativeIsArray = isNative(nativeIsArray = Array.isArray) ? nativeIsArray : null,
nativeIsFinite = context.isFinite,
nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
nativeKeys = isNative(nativeKeys = Object.keys) ? nativeKeys : null,
nativeMax = Math.max,
nativeMin = Math.min,
nativeNow = isNative(nativeNow = Date.now) && nativeNow,
nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite,
nativeNow = isNative(nativeNow = Date.now) ? nativeNow : null,
nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) ? nativeNumIsFinite : null,
nativeParseInt = context.parseInt,
nativeRandom = Math.random;
@@ -1765,7 +1765,7 @@
var index = -1,
isNil = collection == null,
isArr = !isNil && isArrayLike(collection),
length = isArr && collection.length,
length = isArr ? collection.length : 0,
propsLength = props.length,
result = Array(propsLength);
@@ -2352,11 +2352,11 @@
return equalByTag(object, other, objTag);
}
if (!isLoose) {
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (valWrapped || othWrapped) {
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
if (objIsWrapped || othIsWrapped) {
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
}
}
if (!isSameTag) {
@@ -2541,7 +2541,7 @@
return object;
}
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
props = !isSrcArr && keys(source);
props = isSrcArr ? null : keys(source);
arrayEach(props || source, function(srcValue, key) {
if (props) {
@@ -3217,9 +3217,9 @@
return restParam(function(object, sources) {
var index = -1,
length = object == null ? 0 : sources.length,
customizer = length > 2 && sources[length - 2],
guard = length > 2 && sources[2],
thisArg = length > 1 && sources[length - 1];
customizer = length > 2 ? sources[length - 2] : undefined,
guard = length > 2 ? sources[2] : undefined,
thisArg = length > 1 ? sources[length - 1] : undefined;
if (typeof customizer == 'function') {
customizer = bindCallback(customizer, thisArg, 5);
@@ -3661,10 +3661,8 @@
isBindKey = bitmask & BIND_KEY_FLAG,
isCurry = bitmask & CURRY_FLAG,
isCurryBound = bitmask & CURRY_BOUND_FLAG,
isCurryRight = bitmask & CURRY_RIGHT_FLAG;
var Ctor = !isBindKey && createCtorWrapper(func),
key = func;
isCurryRight = bitmask & CURRY_RIGHT_FLAG,
Ctor = isBindKey ? null : createCtorWrapper(func);
function wrapper() {
// Avoid `arguments` object use disqualifying optimizations by
@@ -3711,17 +3709,18 @@
return result;
}
}
var thisBinding = isBind ? thisArg : this;
if (isBindKey) {
func = thisBinding[key];
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
if (argPos) {
args = reorder(args, argPos);
}
if (isAry && ary < args.length) {
args.length = ary;
}
var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtorWrapper(func);
}
return fn.apply(thisBinding, args);
}
return wrapper;
@@ -4547,7 +4546,7 @@
propsLength = props.length,
length = propsLength && object.length;
var allowIndexes = length && isLength(length) &&
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object) || isString(object));
var index = -1,
@@ -6017,8 +6016,8 @@
*/
var zipWith = restParam(function(arrays) {
var length = arrays.length,
iteratee = arrays[length - 2],
thisArg = arrays[length - 1];
iteratee = length > 2 ? arrays[length - 2] : undefined,
thisArg = length > 1 ? arrays[length - 1] : undefined;
if (length > 2 && typeof iteratee == 'function') {
length -= 2;
@@ -6806,7 +6805,7 @@
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) {
var func = isFunc ? path : (isProp && value != null && value[path]);
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null);
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
});
return result;
@@ -8936,7 +8935,7 @@
strictCompareFlags = Array(length);
while (length--) {
value = values[length] = source[props[length]];
var value = values[length] = source[props[length]];
strictCompareFlags[length] = isStrictComparable(value);
}
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
@@ -9758,7 +9757,7 @@
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object != null && object.constructor;
var Ctor = object == null ? null : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object == 'function' ? lodash.support.enumPrototypes : isArrayLike(object))) {
return shimKeys(object);
@@ -10188,7 +10187,7 @@
if (isArr) {
accumulator = isArray(object) ? new Ctor : [];
} else {
accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype);
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null);
}
} else {
accumulator = {};
@@ -11496,8 +11495,8 @@
function mixin(object, source, options) {
if (options == null) {
var isObj = isObject(source),
props = isObj && keys(source),
methodNames = props && props.length && baseFunctions(source, props);
props = isObj ? keys(source) : null,
methodNames = (props && props.length) ? baseFunctions(source, props) : null;
if (!(methodNames ? methodNames.length : isObj)) {
methodNames = false;