Skip to content

Commit 539ffae

Browse files
Trottevanlucas
authored andcommitted
url: improve descriptiveness of identifier
Change variable for protocols that do not always contain `//` to `noLeadingSlashes` so someone reading the code knows what it means. PR-URL: #12579 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 80ceb04 commit 539ffae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/url.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,14 @@ Url.prototype.resolveObject = function resolveObject(relative) {
755755
var removeAllDots = mustEndAbs;
756756
var srcPath = result.pathname && result.pathname.split('/') || [];
757757
var relPath = relative.pathname && relative.pathname.split('/') || [];
758-
var psychotic = result.protocol && !slashedProtocol[result.protocol];
758+
var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];
759759

760760
// if the url is a non-slashed url, then relative
761761
// links like ../.. should be able
762762
// to crawl up to the hostname, as well. This is strange.
763763
// result.protocol has already been set by now.
764764
// Later on, put the first path part into the host field.
765-
if (psychotic) {
765+
if (noLeadingSlashes) {
766766
result.hostname = '';
767767
result.port = null;
768768
if (result.host) {
@@ -810,7 +810,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
810810
// just pull out the search.
811811
// like href='?foo'.
812812
// Put this after the other two cases because it simplifies the booleans
813-
if (psychotic) {
813+
if (noLeadingSlashes) {
814814
result.hostname = result.host = srcPath.shift();
815815
//occasionally the auth can get stuck only in host
816816
//this especially happens in cases like
@@ -891,7 +891,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
891891
(srcPath[0] && srcPath[0].charAt(0) === '/');
892892

893893
// put the host back
894-
if (psychotic) {
894+
if (noLeadingSlashes) {
895895
result.hostname = result.host = isAbsolute ? '' :
896896
srcPath.length ? srcPath.shift() : '';
897897
//occasionally the auth can get stuck only in host

0 commit comments

Comments
 (0)