Permalink
Browse files

improved print() in worker.js

  • Loading branch information...
1 parent 2bd82ac commit 927bba180a176f14b0798018f94164c5c73aa26d maneulyori committed Jan 15, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 modules/eval/worker.js
View
@@ -9,7 +9,7 @@ process.on('message', function(msg) {
out: ""
};
- var prefix = "function print(str) { out += str; }";
+ var prefix = "function print(str) { if(typeof(str) == 'string') { out += str; return ;} else { for (var property in str) { out += property + ': ' + str[property] + '; '; }; }; }";
try{
var script = vm.createScript(prefix + ";" + msg);

0 comments on commit 927bba1

Please sign in to comment.