Add p() like in Ruby.

This commit is contained in:
Ryan 2009-05-14 18:37:53 +02:00
parent dfde465483
commit de6036669d
2 changed files with 5 additions and 1 deletions

View File

@ -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);
}

View File

@ -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"]]);