From 006d42786e3123efb619210fb819b04f2b8b286f Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Sat, 1 Mar 2014 11:09:29 +0900 Subject: [PATCH] lib: use triple equals Signed-off-by: Trevor Norris --- lib/_http_client.js | 4 ++-- lib/_http_outgoing.js | 8 ++++---- lib/_http_server.js | 4 ++-- lib/url.js | 2 +- lib/util.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index e0ce29bc01..50f10d1684 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -386,10 +386,10 @@ function parserOnIncomingClient(res, shouldKeepAlive) { // but *can* have a content-length which actually corresponds // to the content-length of the entity-body had the request // been a GET. - var isHeadResponse = req.method == 'HEAD'; + var isHeadResponse = req.method === 'HEAD'; debug('AGENT isHeadResponse', isHeadResponse); - if (res.statusCode == 100) { + if (res.statusCode === 100) { // restart the parser, as this is a continue message. delete req.res; // Clear res so that we don't hit double-responses. req.emit('continue'); diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 25786ed439..3d87702374 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -228,7 +228,7 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { } // Date header - if (this.sendDate == true && state.sentDateHeader == false) { + if (this.sendDate === true && state.sentDateHeader === false) { state.messageHeader += 'Date: ' + utcDate() + CRLF; } @@ -244,7 +244,7 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { // of creating security liabilities, so suppress the zero chunk and force // the connection to close. var statusCode = this.statusCode; - if ((statusCode == 204 || statusCode === 304) && + if ((statusCode === 204 || statusCode === 304) && this.chunkedEncoding === true) { debug(statusCode + ' response should not use chunked encoding,' + ' closing connection.'); @@ -269,8 +269,8 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { } } - if (state.sentContentLengthHeader == false && - state.sentTransferEncodingHeader == false) { + if (state.sentContentLengthHeader === false && + state.sentTransferEncodingHeader === false) { if (this._hasBody && !this._removedHeader['transfer-encoding']) { if (this.useChunkedEncodingByDefault) { state.messageHeader += 'Transfer-Encoding: chunked\r\n'; diff --git a/lib/_http_server.js b/lib/_http_server.js index eab7d64ff4..934a21eee5 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -156,7 +156,7 @@ ServerResponse.prototype.assignSocket = function(socket) { }; ServerResponse.prototype.detachSocket = function(socket) { - assert(socket._httpMessage == this); + assert(socket._httpMessage === this); socket.removeListener('close', onServerResponseClose); socket._httpMessage = null; this.socket = this.connection = null; @@ -467,7 +467,7 @@ function connectionListener(socket) { // Usually the first incoming element should be our request. it may // be that in the case abortIncoming() was called that the incoming // array will be empty. - assert(incoming.length == 0 || incoming[0] === req); + assert(incoming.length === 0 || incoming[0] === req); incoming.shift(); diff --git a/lib/url.js b/lib/url.js index 887ac0c432..f277da03aa 100644 --- a/lib/url.js +++ b/lib/url.js @@ -610,7 +610,7 @@ Url.prototype.resolveObject = function(relative) { var up = 0; for (var i = srcPath.length; i >= 0; i--) { last = srcPath[i]; - if (last == '.') { + if (last === '.') { srcPath.splice(i, 1); } else if (last === '..') { srcPath.splice(i, 1); diff --git a/lib/util.js b/lib/util.js index 500c1d1751..25220e89d0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -338,7 +338,7 @@ function formatValue(ctx, value, recurseTimes) { base = ' ' + '[Boolean: ' + formatted + ']'; } - if (keys.length === 0 && (!array || value.length == 0)) { + if (keys.length === 0 && (!array || value.length === 0)) { return braces[0] + base + braces[1]; }