Browse Source

Some small optimizations

v0.7.4-release
Bert Belder 13 years ago
committed by Ryan Dahl
parent
commit
153629c99a
  1. 4
      lib/http.js
  2. 19
      lib/net_uv.js

4
lib/http.js

@ -825,7 +825,9 @@ ServerResponse.prototype.writeHead = function(statusCode) {
} else { } else {
// handle object case // handle object case
for (var k in obj) { var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
var k = keys[i];
if (k) headers[k] = obj[k]; if (k) headers[k] = obj[k];
} }
} }

19
lib/net_uv.js

@ -371,18 +371,13 @@ Socket.prototype.write = function(data, arg1, arg2) {
// parse arguments // parse arguments
if (arg1) { if (arg1) {
switch (typeof arg1) { if (typeof arg1 === 'string') {
case 'string': encoding = arg1;
encoding = arg1; cb = arg2;
cb = arg2; } else if (typeof arg1 === 'function') {
break; cb = arg1;
} else {
case 'function': throw new Error("bad arg");
cb = arg1;
break;
default:
throw new Error("bad arg");
} }
} }

Loading…
Cancel
Save