From f960fc066e2daa27658e61e2b5da381c31bfff15 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 2 Apr 2015 02:13:34 +0200 Subject: fixed printing BigNumbers --- jsre/pp_js.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'jsre') diff --git a/jsre/pp_js.go b/jsre/pp_js.go index 78509fc0b..0b22afe6d 100644 --- a/jsre/pp_js.go +++ b/jsre/pp_js.go @@ -25,6 +25,8 @@ function pp(object, indent) { str += " ]"; } else if (object instanceof Error) { str += "\033[31m" + "Error"; + } else if (isBigNumber(object)) { + str += "\033[32m'" + object.toString(10) + "'"; } else if(typeof(object) === "object") { str += "{\n"; indent += " "; @@ -61,6 +63,11 @@ function pp(object, indent) { return str; } +var isBigNumber = function (object) { + return typeof BigNumber !== 'undefined' && object instanceof BigNumber; +}; + + function prettyPrint(/* */) { var args = arguments; var ret = ""; -- cgit v1.2.3