Skip to content
Myr

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

5 files+10 added−9 removed

modified:lib/router/index.js+1 added-1 removed
117 unmodified lines
118 }119120 // 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 }125126 (this.params[name] = this.params[name] || []).push(fn);
519 unmodified lines
modified:lib/request.js+3 added-3 removed
301 unmodified lines
302303/**304 * Short-hand for:305 *306 * req.protocol == 'https'306 * req.protocol === 'https'307 *308 * @return {Boolean}309 * @public310 */
125 unmodified lines
436 var method = this.method;437 var s = this.res.statusCode;438439 // GET or HEAD for weak freshness validation only440 if ('GET' != method && 'HEAD' != method) return false;440 if ('GET' !== method && 'HEAD' !== method) return false;441442 // 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 }446447 return false;
42 unmodified lines
modified:lib/response.js+1 added-1 removed
187 unmodified lines
188 // freshness189 if (req.fresh) this.statusCode = 304;190191 // 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 lines
modified:lib/utils.js+4 added-4 removed
64 unmodified lines
65 * @api private66 */6768exports.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};7374/**75 * Flatten the given `arr`.
65 unmodified lines
141 var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };142143 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 lines
modified:History.md+1 added
27 unmodified lines
28 - 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 possible33344.13.4 / 2016-01-2135===================36
3059 unmodified lines