mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Remove old JIT and engine bug guards.
This commit is contained in:
28
lodash.js
28
lodash.js
@@ -2824,12 +2824,7 @@
|
|||||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseHas(object, key) {
|
function baseHas(object, key) {
|
||||||
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
|
return object != null && hasOwnProperty.call(object, key);
|
||||||
// that are composed entirely of index properties, return `false` for
|
|
||||||
// `hasOwnProperty` checks of them.
|
|
||||||
return object != null &&
|
|
||||||
(hasOwnProperty.call(object, key) ||
|
|
||||||
(typeof object == 'object' && key in object && getPrototype(object) === null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4004,7 +3999,7 @@
|
|||||||
object = parent(object, path);
|
object = parent(object, path);
|
||||||
|
|
||||||
var key = toKey(last(path));
|
var key = toKey(last(path));
|
||||||
return !(object != null && baseHas(object, key)) || delete object[key];
|
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5412,7 +5407,7 @@
|
|||||||
var index = objLength;
|
var index = objLength;
|
||||||
while (index--) {
|
while (index--) {
|
||||||
var key = objProps[index];
|
var key = objProps[index];
|
||||||
if (!(isPartial ? key in other : baseHas(other, key))) {
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5548,19 +5543,6 @@
|
|||||||
return arguments.length ? result(arguments[0], arguments[1]) : result;
|
return arguments.length ? result(arguments[0], arguments[1]) : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the "length" property value of `object`.
|
|
||||||
*
|
|
||||||
* **Note:** This function is used to avoid a
|
|
||||||
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
|
|
||||||
* Safari on at least iOS 8.1-8.3 ARM64.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to query.
|
|
||||||
* @returns {*} Returns the "length" value.
|
|
||||||
*/
|
|
||||||
var getLength = baseProperty('length');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the data for `map`.
|
* Gets the data for `map`.
|
||||||
*
|
*
|
||||||
@@ -10888,7 +10870,7 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArrayLike(value) {
|
function isArrayLike(value) {
|
||||||
return value != null && isLength(getLength(value)) && !isFunction(value);
|
return value != null && isLength(value.length) && !isFunction(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12838,7 +12820,7 @@
|
|||||||
length = result.length;
|
length = result.length;
|
||||||
|
|
||||||
for (var key in object) {
|
for (var key in object) {
|
||||||
if (baseHas(object, key) &&
|
if (hasOwnProperty.call(object, key) &&
|
||||||
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||||
!(isProto && key == 'constructor')) {
|
!(isProto && key == 'constructor')) {
|
||||||
result.push(key);
|
result.push(key);
|
||||||
|
|||||||
49
test/test.js
49
test/test.js
@@ -5785,26 +5785,6 @@
|
|||||||
|
|
||||||
assert.deepEqual(_.filter(array, isEven), [2]);
|
assert.deepEqual(_.filter(array, isEven), [2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should iterate over an object with numeric keys (test in Mobile Safari 8)', function(assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
|
|
||||||
// Trigger a mobile Safari 8 JIT bug.
|
|
||||||
// See https://github.com/lodash/lodash/issues/799.
|
|
||||||
var counter = 0,
|
|
||||||
object = { '1': 'foo', '8': 'bar', '50': 'baz' };
|
|
||||||
|
|
||||||
lodashStable.times(1000, function(assert) {
|
|
||||||
_.filter([], stubTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
_.filter(object, function() {
|
|
||||||
counter++;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.strictEqual(counter, 3);
|
|
||||||
});
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -7805,19 +7785,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should work for objects with a `[[Prototype]]` of `null`', function(assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
|
|
||||||
if (create) {
|
|
||||||
var object = create(null);
|
|
||||||
object[1] = 'a';
|
|
||||||
assert.strictEqual(func(object, 1), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should check for a key over a path', function(assert) {
|
QUnit.test('`_.' + methodName + '` should check for a key over a path', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
@@ -11238,22 +11205,6 @@
|
|||||||
skipAssert(assert, 7);
|
skipAssert(assert, 7);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should avoid V8 bug #2291 (test in Chrome 19-20)', function(assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
|
|
||||||
// Trigger a V8 JIT bug.
|
|
||||||
// See https://code.google.com/p/v8/issues/detail?id=2291.
|
|
||||||
var object = {};
|
|
||||||
|
|
||||||
// First, have a comparison statement.
|
|
||||||
object == object;
|
|
||||||
|
|
||||||
// Then perform the check with `object`.
|
|
||||||
_.isObject(object);
|
|
||||||
|
|
||||||
assert.strictEqual(_.isObject('a'), false);
|
|
||||||
});
|
|
||||||
}(1, 2, 3));
|
}(1, 2, 3));
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user