Maybe just:
return url.split('/')[0];

Although I wonder if we could do getHost and getBaseDomain code like:

var match = url.replace('\\', '/').match(/\:\/\/([^\/]+)\//);
return match ? match[1] : "";