File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -443,9 +443,14 @@ if (typeof NumberDecimal !== 'undefined') {
443443 if ( ! NumberDecimal . prototype ) {
444444 NumberDecimal . prototype = { } ;
445445 }
446+ NumberDecimal . prototype . nativeToString = NumberDecimal . prototype . toString
446447
447448 NumberDecimal . prototype . tojson = function ( ) {
448- return this . toString ( ) ;
449+ return this . nativeToString ( ) ;
450+ } ;
451+
452+ NumberDecimal . prototype . toString = function ( ) {
453+ return `NumberDecimal("${ this . nativeToString ( ) } ")` ;
449454 } ;
450455}
451456
Original file line number Diff line number Diff line change @@ -22,3 +22,6 @@ assert.strictEqual(minLong.bottom, 0);
2222assert . strictEqual ( minLong . exactValueString , "-9223372036854775808" ) ;
2323const nl2 = NumberLong ( "200" ) ;
2424assert . strictEqual ( maxLong . compare ( nl2 ) , 1 ) ;
25+ const decimal = NumberDecimal ( "1.1" ) ;
26+ assert . strictEqual ( decimal . toString ( ) , 'NumberDecimal("1.1")' ) ;
27+ assert . strictEqual ( decimal . tojson ( ) , '1.1' ) ;
You can’t perform that action at this time.
0 commit comments