Skip to content

Commit 429976c

Browse files
committed
#210 Check for Symbol support.
2 parents 99ae769 + c2f43de commit 429976c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

big.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,11 +960,14 @@ P.toFixed = function (dp, rm) {
960960
* Big.PE, or a negative exponent equal to or less than Big.NE.
961961
* Omit the sign for negative zero.
962962
*/
963-
P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON = P.toString = function () {
963+
P.toJSON = P.toString = function () {
964964
var x = this,
965965
Big = x.constructor;
966966
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
967967
};
968+
if (typeof Symbol !== "undefined") {
969+
P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON;
970+
}
968971

969972

970973
/*

0 commit comments

Comments
 (0)