Add p() like in Ruby.
authorRyan <ry@tinyclouds.org>
Thu, 14 May 2009 16:37:53 +0000 (18:37 +0200)
committerRyan <ry@tinyclouds.org>
Thu, 14 May 2009 16:37:53 +0000 (18:37 +0200)
src/file.js
test/test_http.js

index 4098411..028a3b9 100644 (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);
+}
index 9445a13..58d5c86 100644 (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"]]);