Replace Symbol checks with Symbol methods as checks instead. [closes #2039]

This commit is contained in:
John-David Dalton
2016-02-23 08:30:48 -08:00
parent 54294f15ef
commit f644c82da4

View File

@@ -1383,8 +1383,8 @@
/** Used to convert symbols to primitives and strings. */ /** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined, var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = Symbol ? symbolProto.valueOf : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
symbolToString = Symbol ? symbolProto.toString : undefined; symbolToString = symbolProto ? symbolProto.toString : undefined;
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
@@ -3862,7 +3862,7 @@
* @returns {Object} Returns the cloned symbol object. * @returns {Object} Returns the cloned symbol object.
*/ */
function cloneSymbol(symbol) { function cloneSymbol(symbol) {
return Symbol ? Object(symbolValueOf.call(symbol)) : {}; return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
} }
/** /**
@@ -4798,7 +4798,7 @@
return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack); return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack);
case symbolTag: case symbolTag:
return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); return !!symbolValueOf && (symbolValueOf.call(object) == symbolValueOf.call(other));
} }
return false; return false;
} }
@@ -10804,7 +10804,7 @@
return ''; return '';
} }
if (isSymbol(value)) { if (isSymbol(value)) {
return Symbol ? symbolToString.call(value) : ''; return symbolToString ? symbolToString.call(value) : '';
} }
var result = (value + ''); var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;