mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v3.5.0.
This commit is contained in:
@@ -23,7 +23,7 @@ define(['./baseCopy', '../object/keys'], function(baseCopy, keys) {
|
||||
value = object[key],
|
||||
result = customizer(value, source[key], key, object, source);
|
||||
|
||||
if ((result === result ? result !== value : value === value) ||
|
||||
if ((result === result ? (result !== value) : (value === value)) ||
|
||||
(typeof value == 'undefined' && !(key in object))) {
|
||||
object[key] = result;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ define([], function() {
|
||||
if (end < 0) {
|
||||
end += length;
|
||||
}
|
||||
length = start > end ? 0 : end >>> 0;
|
||||
length = start > end ? 0 : (end >>> 0);
|
||||
start >>>= 0;
|
||||
|
||||
while (start < length) {
|
||||
|
||||
@@ -34,7 +34,7 @@ define(['./arrayEach', './baseForOwn', './baseMergeDeep', '../lang/isArray', './
|
||||
result = srcValue;
|
||||
}
|
||||
if ((isSrcArr || typeof result != 'undefined') &&
|
||||
(isCommon || (result === result ? result !== value : value === value))) {
|
||||
(isCommon || (result === result ? (result !== value) : (value === value)))) {
|
||||
object[key] = result;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ define(['./arrayCopy', '../lang/isArguments', '../lang/isArray', './isLength', '
|
||||
if (isCommon) {
|
||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
|
||||
} else if (result === result ? result !== value : value === value) {
|
||||
} else if (result === result ? (result !== value) : (value === value)) {
|
||||
object[key] = result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ define([], function() {
|
||||
if (end < 0) {
|
||||
end += length;
|
||||
}
|
||||
length = start > end ? 0 : (end - start) >>> 0;
|
||||
length = start > end ? 0 : ((end - start) >>> 0);
|
||||
start >>>= 0;
|
||||
|
||||
var result = Array(length);
|
||||
|
||||
@@ -26,9 +26,8 @@ define(['./baseCompareAscending'], function(baseCompareAscending) {
|
||||
if (result) {
|
||||
if (index >= ordersLength) {
|
||||
return result;
|
||||
} else {
|
||||
return orders[index] ? result : result * -1;
|
||||
}
|
||||
return result * (orders[index] ? 1 : -1);
|
||||
}
|
||||
}
|
||||
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./createCtorWrapper'], function(createCtorWrapper) {
|
||||
define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) {
|
||||
|
||||
/**
|
||||
* Creates a function that wraps `func` and invokes it with the `this`
|
||||
@@ -13,7 +13,8 @@ define(['./createCtorWrapper'], function(createCtorWrapper) {
|
||||
var Ctor = createCtorWrapper(func);
|
||||
|
||||
function wrapper() {
|
||||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments);
|
||||
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||
return fn.apply(thisArg, arguments);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ define([], function() {
|
||||
return function() {
|
||||
var length = arguments.length,
|
||||
index = length,
|
||||
fromIndex = fromRight ? length - 1 : 0;
|
||||
fromIndex = fromRight ? (length - 1) : 0;
|
||||
|
||||
if (!length) {
|
||||
return function() { return arguments[0]; };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './reorder', './replaceHolders'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, reorder, replaceHolders) {
|
||||
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './reorder', './replaceHolders', './root'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, reorder, replaceHolders, root) {
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1,
|
||||
@@ -91,7 +91,8 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapp
|
||||
if (isAry && ary < args.length) {
|
||||
args.length = ary;
|
||||
}
|
||||
return (this instanceof wrapper ? (Ctor || createCtorWrapper(func)) : func).apply(thisBinding, args);
|
||||
var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
|
||||
return fn.apply(thisBinding, args);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./createCtorWrapper'], function(createCtorWrapper) {
|
||||
define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) {
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1;
|
||||
@@ -34,7 +34,8 @@ define(['./createCtorWrapper'], function(createCtorWrapper) {
|
||||
while (argsLength--) {
|
||||
args[leftIndex++] = arguments[++argsIndex];
|
||||
}
|
||||
return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args);
|
||||
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||
return fn.apply(isBind ? thisArg : this, args);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,10 @@ define(['../object/keys'], function(keys) {
|
||||
othCtor = other.constructor;
|
||||
|
||||
// Non `Object` object instances with different constructors are not equal.
|
||||
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
|
||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||
if (objCtor != othCtor &&
|
||||
('constructor' in object && 'constructor' in other) &&
|
||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
||||
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ define(['./baseEach'], function(baseEach) {
|
||||
|
||||
baseEach(collection, function(value, index, collection) {
|
||||
var current = iteratee(value, index, collection);
|
||||
if ((isMin ? current < computed : current > computed) || (current === exValue && current === result)) {
|
||||
if ((isMin ? (current < computed) : (current > computed)) ||
|
||||
(current === exValue && current === result)) {
|
||||
computed = current;
|
||||
result = value;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ define(['./isIndex', './isLength', '../lang/isObject'], function(isIndex, isLeng
|
||||
}
|
||||
if (prereq) {
|
||||
var other = object[index];
|
||||
return value === value ? value === other : other !== other;
|
||||
return value === value ? (value === other) : (other !== other);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ define(['./LazyWrapper', './arrayCopy'], function(LazyWrapper, arrayCopy) {
|
||||
|
||||
result.__actions__ = actions ? arrayCopy(actions) : null;
|
||||
result.__dir__ = this.__dir__;
|
||||
result.__dropCount__ = this.__dropCount__;
|
||||
result.__filtered__ = this.__filtered__;
|
||||
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
|
||||
result.__takeCount__ = this.__takeCount__;
|
||||
|
||||
@@ -2,8 +2,8 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
||||
|
||||
/** Used to indicate the type of lazy iteratees. */
|
||||
var LAZY_DROP_WHILE_FLAG = 0,
|
||||
LAZY_MAP_FLAG = 2,
|
||||
LAZY_TAKE_WHILE_FLAG = 3;
|
||||
LAZY_FILTER_FLAG = 1,
|
||||
LAZY_MAP_FLAG = 2;
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
@@ -27,9 +27,8 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
||||
start = view.start,
|
||||
end = view.end,
|
||||
length = end - start,
|
||||
dropCount = this.__dropCount__,
|
||||
index = isRight ? end : (start - 1),
|
||||
takeCount = nativeMin(length, this.__takeCount__),
|
||||
index = isRight ? end : start - 1,
|
||||
iteratees = this.__iteratees__,
|
||||
iterLength = iteratees ? iteratees.length : 0,
|
||||
resIndex = 0,
|
||||
@@ -47,28 +46,32 @@ define(['./baseWrapperValue', './getView', '../lang/isArray'], function(baseWrap
|
||||
iteratee = data.iteratee,
|
||||
type = data.type;
|
||||
|
||||
if (type != LAZY_DROP_WHILE_FLAG) {
|
||||
var computed = iteratee(value);
|
||||
} else {
|
||||
data.done = data.done && (isRight ? index < data.index : index > data.index);
|
||||
if (type == LAZY_DROP_WHILE_FLAG) {
|
||||
if (data.done && (isRight ? (index > data.index) : (index < data.index))) {
|
||||
data.count = 0;
|
||||
data.done = false;
|
||||
}
|
||||
data.index = index;
|
||||
computed = data.done || (data.done = !iteratee(value));
|
||||
}
|
||||
if (type == LAZY_MAP_FLAG) {
|
||||
value = computed;
|
||||
} else if (!computed) {
|
||||
if (type == LAZY_TAKE_WHILE_FLAG) {
|
||||
break outer;
|
||||
} else {
|
||||
continue outer;
|
||||
if (!data.done) {
|
||||
var limit = data.limit;
|
||||
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var computed = iteratee(value);
|
||||
if (type == LAZY_MAP_FLAG) {
|
||||
value = computed;
|
||||
} else if (!computed) {
|
||||
if (type == LAZY_FILTER_FLAG) {
|
||||
continue outer;
|
||||
} else {
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dropCount) {
|
||||
dropCount--;
|
||||
} else {
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user