Fix passing non-string value to print/println in node.js
See KT-15484
This commit is contained in:
+7
-2
@@ -3,7 +3,7 @@ var buffer = "";
|
||||
function writeToBuffer(a) {
|
||||
var type = typeof a;
|
||||
if (type === "undefined") return;
|
||||
if (type !== "string") throw Error("Expected string argument type, but got: " + type);
|
||||
if (type !== "string" && !(a instanceof String)) throw Error("Expected string argument type, but got: " + type);
|
||||
|
||||
buffer += a;
|
||||
}
|
||||
@@ -16,7 +16,12 @@ function writelnToBuffer(a) {
|
||||
var GLOBAL = (0, eval)("this");
|
||||
|
||||
GLOBAL.console = {
|
||||
log: writelnToBuffer
|
||||
log: function (a) {
|
||||
if (typeof a !== "undefined") {
|
||||
buffer += a
|
||||
}
|
||||
buffer += "\n";
|
||||
}
|
||||
};
|
||||
|
||||
GLOBAL.outputStream = {
|
||||
|
||||
Reference in New Issue
Block a user