mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Avoid a JIT bug in Safari 9 for baseIteratee.
This commit is contained in:
@@ -3108,14 +3108,15 @@
|
|||||||
* @returns {Function} Returns the iteratee.
|
* @returns {Function} Returns the iteratee.
|
||||||
*/
|
*/
|
||||||
function baseIteratee(value) {
|
function baseIteratee(value) {
|
||||||
var type = typeof value;
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
||||||
if (type == 'function') {
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
||||||
|
if (typeof value == 'function') {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return identity;
|
return identity;
|
||||||
}
|
}
|
||||||
if (type == 'object') {
|
if (typeof value == 'object') {
|
||||||
return isArray(value)
|
return isArray(value)
|
||||||
? baseMatchesProperty(value[0], value[1])
|
? baseMatchesProperty(value[0], value[1])
|
||||||
: baseMatches(value);
|
: baseMatches(value);
|
||||||
|
|||||||
@@ -5534,7 +5534,7 @@
|
|||||||
QUnit.test('should iterate over an object with numeric keys (test in Mobile Safari 8)', function(assert) {
|
QUnit.test('should iterate over an object with numeric keys (test in Mobile Safari 8)', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
// Trigger a Mobile Safari 8 JIT bug.
|
// Trigger a mobile Safari 8 JIT bug.
|
||||||
// See https://github.com/lodash/lodash/issues/799.
|
// See https://github.com/lodash/lodash/issues/799.
|
||||||
var counter = 0,
|
var counter = 0,
|
||||||
object = { '1': 'foo', '8': 'bar', '50': 'baz' };
|
object = { '1': 'foo', '8': 'bar', '50': 'baz' };
|
||||||
@@ -10914,10 +10914,10 @@
|
|||||||
// See https://code.google.com/p/v8/issues/detail?id=2291.
|
// See https://code.google.com/p/v8/issues/detail?id=2291.
|
||||||
var object = {};
|
var object = {};
|
||||||
|
|
||||||
// 1: Useless comparison statement, this is half the trigger.
|
// First, have a comparison statement.
|
||||||
object == object;
|
object == object;
|
||||||
|
|
||||||
// 2: Initial check with object, this is the other half of the trigger.
|
// Then perform the check with `object`.
|
||||||
_.isObject(object);
|
_.isObject(object);
|
||||||
|
|
||||||
assert.strictEqual(_.isObject('a'), false);
|
assert.strictEqual(_.isObject('a'), false);
|
||||||
|
|||||||
Reference in New Issue
Block a user