Style nit: please use braces and newlines in control statements, i.e.
```
if (isName(url)) {
  url = '/' + url.name;
} else {
  url = addDefaultProtocolToUrl(url);
}
```
or you could just do `url = isName(url) ? ('/' + url.name) : addDefaultProtocolToUrl(url);`.