src/stringProcessing/url.js
function isInternalLink( url, host ) {
	const parsedUrl = urlMethods.parse( url, false, true );
	// Check if the URL starts with a single slash.
	if ( url.indexOf( "//" ) === -1 && url.indexOf( "/" ) === 0 ) {
		return true;
	}

	// Check if the URL starts with a # indicating a fragment.
	if ( url.indexOf( "#" ) === 0 ) {
		return false;
	}

	// No host indicates an internal link.
	if ( ! parsedUrl.host ) {
		return true;
	}

	return parsedUrl.host === host;
}
function isInternalLink( url, host ) {
	const parsedUrl = urlMethods.parse( url, false, true );
	// Check if the URL starts with a single slash.
	if ( url.indexOf( "//" ) === -1 && url.indexOf( "/" ) === 0 ) {
		return true;
	}

	// Check if the URL starts with a # indicating a fragment.
	if ( url.indexOf( "#" ) === 0 ) {
		return false;
	}

	// No host indicates an internal link.
	if ( ! parsedUrl.host ) {
		return true;
	}

	return parsedUrl.host === host;
}
function isInternalLink ( url , host ) { const parsedUrl = urlMethods . parse ( url , false , true ) ; // Check if the URL starts with a single slash. if ( url . indexOf ( "//" ) === - 1 && url . indexOf ( "/" ) === 0 ) { return true ; } // Check if the URL starts with a # indicating a fragment. if ( url . indexOf ( "#" ) === 0 ) { return false ; } // No host indicates an internal link. if ( ! parsedUrl . host ) { return true ; } return parsedUrl . host === host ; }
Determine whether a URL is internal.

@param {string} url The URL to test.
@param {string} host The current host.

@returns {boolean} Whether or not the URL is internal.
Determine whether a URL is internal .