Skip to content

Commit c2f43de

Browse files
authored
Merge pull request #210 from linsk1998/master
Check for Symbol support
2 parents 4df3d1a + 4fd0396 commit c2f43de

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
@@ -957,11 +957,14 @@ P.toFixed = function (dp, rm) {
957957
* Big.PE, or a negative exponent equal to or less than Big.NE.
958958
* Omit the sign for negative zero.
959959
*/
960-
P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON = P.toString = function () {
960+
P.toJSON = P.toString = function () {
961961
var x = this,
962962
Big = x.constructor;
963963
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
964964
};
965+
if (typeof Symbol !== "undefined") {
966+
P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON;
967+
}
965968

966969

967970
/*

0 commit comments

Comments
 (0)