Permalink
Browse files

Rename String.printf() to String.sprintf()

  • Loading branch information...
1 parent cefc4ab commit 7d1d9f00fbd1bb1dfad07e21450f7a4baa6e4ce8 @nicwolff committed Feb 5, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 server.js
View
@@ -25,7 +25,7 @@ var http = require('http'),
fs.stat( filename, function (error, stat) {
if (error) {
- response.writeHead( 500, 'Error while reading %s: %s'.printf( resource, error ) );
+ response.writeHead( 500, 'Error while reading %s: %s'.sprintf( resource, error ) );
response.end();
} else {
var filesize = stat.size;
@@ -73,7 +73,7 @@ var http = require('http'),
console.log( 'Looking for files in ' + path );
-String.prototype.printf = function () {
+String.prototype.sprintf = function () {
var args = arguments, i = 0;
return this.replace( /\%s/g, function () { return args[i++] } );
}
@@ -87,12 +87,12 @@ http.createServer( function (request, response) {
console.log( 'Illegal request for ' + resource );
return;
}
- console.log( 'Routing request for %s to %s(%s)'.printf( request.url, method, resource ) );
+ console.log( 'Routing request for %s to %s(%s)'.sprintf( request.url, method, resource ) );
var h;
if ( h = handlers[ method ] ) {
h( resource, request, response );
} else {
- response.writeHead( 405, 'Method %s not allowed on resource %s'.printf( method, resource ) );
+ response.writeHead( 405, 'Method %s not allowed on resource %s'.sprintf( method, resource ) );
response.end();
}
} ).listen(8124);

0 comments on commit 7d1d9f0

Please sign in to comment.