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