From 8e9f59a4521f4af66ecd46b0efdda11e52329056 Mon Sep 17 00:00:00 2001 From: Jerome Etienne Date: Wed, 7 Jul 2010 11:58:33 +0200 Subject: [PATCH] Support of console.dir + console.assert --- src/node.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/node.js b/src/node.js index 97b1f1b9dfb..2319527104e 100644 --- a/src/node.js +++ b/src/node.js @@ -220,6 +220,17 @@ global.console.warn = function () { global.console.error = global.console.warn; +global.console.dir = function(object){ + var sys = module.requireNative('sys'); + process.stdout.write(sys.inspect(object) + '\n'); +} + +global.console.assert = function(expression){ + if(!expression){ + var arr = Array.prototype.slice.call(arguments, 1); + process.assert(false, format.apply(this, arr)); + } +} process.exit = function (code) { process.emit("exit");