mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Replace Symbol checks with Symbol methods as checks instead. [closes #2039]
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -1383,8 +1383,8 @@
|
||||
|
||||
/** Used to convert symbols to primitives and strings. */
|
||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||
symbolValueOf = Symbol ? symbolProto.valueOf : undefined,
|
||||
symbolToString = Symbol ? symbolProto.toString : undefined;
|
||||
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
|
||||
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
@@ -3862,7 +3862,7 @@
|
||||
* @returns {Object} Returns the cloned symbol object.
|
||||
*/
|
||||
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);
|
||||
|
||||
case symbolTag:
|
||||
return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other));
|
||||
return !!symbolValueOf && (symbolValueOf.call(object) == symbolValueOf.call(other));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -10804,7 +10804,7 @@
|
||||
return '';
|
||||
}
|
||||
if (isSymbol(value)) {
|
||||
return Symbol ? symbolToString.call(value) : '';
|
||||
return symbolToString ? symbolToString.call(value) : '';
|
||||
}
|
||||
var result = (value + '');
|
||||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||||
|
||||
Reference in New Issue
Block a user