console.log: if not string, coerce into one

v0.7.4-release
Ryan Dahl 2010-06-29 09:53:12 -07:00
parent 5aadeae888
commit 6b430a95c9
1 changed files with 1 additions and 1 deletions

View File

@ -194,7 +194,7 @@ process.openStdin = function () {
function format (f) { function format (f) {
var i = 1; var i = 1;
var args = arguments; var args = arguments;
if (!(f instanceof String)) return f; if (!(f instanceof String)) f = String(f);
return f.replace(/%([sdf])/g, function (x) { return f.replace(/%([sdf])/g, function (x) {
switch (x) { switch (x) {
case '%s': return args[i++]; case '%s': return args[i++];