mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +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. */
|
/** 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user