소스 검색

output BigNumbers objects in console as strings

Bas van Kervel 10 년 전
부모
커밋
6ea28f93b9
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      jsre/pp_js.go

+ 9 - 1
jsre/pp_js.go

@@ -97,7 +97,15 @@ var isMemberFunction = function(object, member) {
 }
 
 var isBigNumber = function (object) {
-    return typeof BigNumber !== 'undefined' && object instanceof BigNumber;
+    var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber;
+
+    if (!result) {
+    	if(typeof(object) === "object") {
+			result = object.constructor.toString().indexOf("function BigNumber(") == 0;
+		}
+    }
+
+    return result
 };
 
 function prettyPrint(/* */) {