diff --git a/History.md b/History.md index 9aa6b0acc0..764974d078 100644 --- a/History.md +++ b/History.md @@ -29,6 +29,7 @@ unreleased - deps: ipaddr.js@1.1.1 * deps: vary@~1.1.0 - Only accept valid field names in the `field` argument + * perf: use strict equality when possible 4.13.4 / 2016-01-21 =================== diff --git a/lib/request.js b/lib/request.js index 33cac180ed..4fdc279ebc 100644 --- a/lib/request.js +++ b/lib/request.js @@ -303,7 +303,7 @@ defineGetter(req, 'protocol', function protocol(){ /** * Short-hand for: * - * req.protocol == 'https' + * req.protocol === 'https' * * @return {Boolean} * @public @@ -437,10 +437,10 @@ defineGetter(req, 'fresh', function(){ var s = this.res.statusCode; // GET or HEAD for weak freshness validation only - if ('GET' != method && 'HEAD' != method) return false; + if ('GET' !== method && 'HEAD' !== method) return false; // 2xx or 304 as per rfc2616 14.26 - if ((s >= 200 && s < 300) || 304 == s) { + if ((s >= 200 && s < 300) || 304 === s) { return fresh(this.headers, (this.res._headers || {})); } diff --git a/lib/response.js b/lib/response.js index e813c52ec1..b93459cff5 100644 --- a/lib/response.js +++ b/lib/response.js @@ -189,7 +189,7 @@ res.send = function send(body) { if (req.fresh) this.statusCode = 304; // strip irrelevant headers - if (204 == this.statusCode || 304 == this.statusCode) { + if (204 === this.statusCode || 304 === this.statusCode) { this.removeHeader('Content-Type'); this.removeHeader('Content-Length'); this.removeHeader('Transfer-Encoding'); diff --git a/lib/router/index.js b/lib/router/index.js index 504ed9ce0e..dac2514815 100644 --- a/lib/router/index.js +++ b/lib/router/index.js @@ -119,7 +119,7 @@ proto.param = function param(name, fn) { // ensure we end up with a // middleware function - if ('function' != typeof fn) { + if ('function' !== typeof fn) { throw new Error('invalid param() call for ' + name + ', got ' + fn); } diff --git a/lib/utils.js b/lib/utils.js index 3d54247ad2..465b31f536 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -66,9 +66,9 @@ exports.wetag = function wetag(body, encoding){ */ exports.isAbsolute = function(path){ - if ('/' == path[0]) return true; - if (':' == path[1] && '\\' == path[2]) return true; - if ('\\\\' == path.substring(0, 2)) return true; // Microsoft Azure absolute path + if ('/' === path[0]) return true; + if (':' === path[1] && '\\' === path[2]) return true; + if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path }; /** @@ -142,7 +142,7 @@ function acceptParams(str, index) { for (var i = 1; i < parts.length; ++i) { var pms = parts[i].split(/ *= */); - if ('q' == pms[0]) { + if ('q' === pms[0]) { ret.quality = parseFloat(pms[1]); } else { ret.params[pms[0]] = pms[1];