perf: use strict equality when possible
Before adoption: this commit came in with the history the project adopted, so no landing records it.
closes #2722
authored by Ángel Sanz · committed by Douglas Christopher Wilson · parent c6039af · Browse files · 5 files·+10 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+10 added−9 removed
- other:+10 added−9 removed
Provenance
- Commit
b69b760- Tree
b7bd451- Author
Ángel Sanz <angelsanzgit@gmail.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
c6039af
5 files changed+10 added−9 removed
modified:lib/router/index.js+1 added-1 removed
117 unmodified lines118 }119 120 // ensure we end up with a121 // middleware function122- if ('function' != typeof fn) {122+ if ('function' !== typeof fn) {123 throw new Error('invalid param() call for ' + name + ', got ' + fn);124 }125 126 (this.params[name] = this.params[name] || []).push(fn);519 unmodified linesmodified:lib/request.js+3 added-3 removed
301 unmodified lines302 303 /**304 * Short-hand for:305 *306- * req.protocol == 'https'306+ * req.protocol === 'https'307 *308 * @return {Boolean}309 * @public310 */125 unmodified lines436 var method = this.method;437 var s = this.res.statusCode;438 439 // GET or HEAD for weak freshness validation only440- if ('GET' != method && 'HEAD' != method) return false;440+ if ('GET' !== method && 'HEAD' !== method) return false;441 442 // 2xx or 304 as per rfc2616 14.26443- if ((s >= 200 && s < 300) || 304 == s) {443+ if ((s >= 200 && s < 300) || 304 === s) {444 return fresh(this.headers, (this.res._headers || {}));445 }446 447 return false;42 unmodified linesmodified:lib/response.js+1 added-1 removed
187 unmodified lines188 // freshness189 if (req.fresh) this.statusCode = 304;190 191 // strip irrelevant headers192- if (204 == this.statusCode || 304 == this.statusCode) {192+ if (204 === this.statusCode || 304 === this.statusCode) {193 this.removeHeader('Content-Type');194 this.removeHeader('Content-Length');195 this.removeHeader('Transfer-Encoding');196 chunk = '';857 unmodified linesmodified:lib/utils.js+4 added-4 removed
64 unmodified lines65 * @api private66 */67 68 exports.isAbsolute = function(path){69- if ('/' == path[0]) return true;70- if (':' == path[1] && '\\' == path[2]) return true;71- if ('\\\\' == path.substring(0, 2)) return true; // Microsoft Azure absolute path69+ if ('/' === path[0]) return true;70+ if (':' === path[1] && '\\' === path[2]) return true;71+ if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path72 };73 74 /**75 * Flatten the given `arr`.65 unmodified lines141 var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };142 143 for (var i = 1; i < parts.length; ++i) {144 var pms = parts[i].split(/ *= */);145- if ('q' == pms[0]) {145+ if ('q' === pms[0]) {146 ret.quality = parseFloat(pms[1]);147 } else {148 ret.params[pms[0]] = pms[1];149 }151 unmodified linesmodified:History.md+1 added
27 unmodified lines28 - IPv6 addresses cannot be used as a netmask29 - deps: ipaddr.js@1.1.130 * deps: vary@~1.1.031 - Only accept valid field names in the `field` argument32+ * perf: use strict equality when possible33 34 4.13.4 / 2016-01-2135 ===================36 3059 unmodified lines