diff --git a/src/util.js b/src/util.js index 66ce2e85bd..ad0a4cd88c 100644 --- a/src/util.js +++ b/src/util.js @@ -99,16 +99,20 @@ puts = function (x) { print(x.toString() + "\n"); }; +node.debug = function (x) { + node.stdio.writeError("DEBUG: " + x.toString() + "\n"); +}; + +node.error = function (x) { + node.stdio.writeError(x.toString() + "\n"); +}; + p = function (x) { if (x === null) { - puts("null"); + node.error("null"); } else if (x === NaN) { - puts("NaN"); + node.error("NaN"); } else { - puts(JSON.stringify(x) || "undefined"); + node.error(JSON.stringify(x) || "undefined"); } }; - -node.debug = function (x) { - node.stdio.writeError("DEBUG: " + x.toString() + "\n"); -};