From de6036669d37b16fc9d169ff6f0eabd0c3f9b5b5 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 14 May 2009 18:37:53 +0200 Subject: [PATCH] Add p() like in Ruby. --- src/file.js | 4 ++++ test/test_http.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file.js b/src/file.js index 4098411763..028a3b9803 100644 --- a/src/file.js +++ b/src/file.js @@ -131,3 +131,7 @@ stdin.fd = File.STDIN_FILENO; this.puts = function (data, callback) { stdout.puts(data, callback); } + +this.p = function (data, callback) { + puts(JSON.stringify(data), callback); +} diff --git a/test/test_http.js b/test/test_http.js index 9445a13b08..58d5c86061 100644 --- a/test/test_http.js +++ b/test/test_http.js @@ -1,4 +1,4 @@ -puts(JSON.stringify({hello: "world"})); +p({hello: "world"}); new node.http.Server(function (msg) { setTimeout(function () { msg.sendHeader(200, [["Content-Type", "text/plain"]]);