1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00

Added custom util.inspect() function that just prints out the "toString()" result of the decimal.

This commit is contained in:
Adrian Hara 2019-02-25 16:57:24 +01:00
parent 9106f0a010
commit bc2979c96a
3 changed files with 5 additions and 3 deletions

View File

@ -4367,6 +4367,7 @@
Decimal.tanh = tanh; // ES6 Decimal.tanh = tanh; // ES6
Decimal.trunc = trunc; // ES6 Decimal.trunc = trunc; // ES6
if (obj === void 0) obj = {}; if (obj === void 0) obj = {};
if (obj) { if (obj) {
if (obj.defaults !== true) { if (obj.defaults !== true) {
@ -4809,6 +4810,9 @@
// Node and other environments that support module.exports. // Node and other environments that support module.exports.
} else if (typeof module != 'undefined' && module.exports) { } else if (typeof module != 'undefined' && module.exports) {
Decimal.prototype[Symbol.for('nodejs.util.inspect.custom')] = function() {
return this.toString();
};
module.exports = Decimal; module.exports = Decimal;
// Browser. // Browser.

3
decimal.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long