     # Allow known special host names
     return true if hostName in specialHostNames
 
-    # Allow IPv6 addresses (need to be wrapped in brackets as required by
-    # RFC). It is sufficient to check for a colon, as the regex wouldn't
-    # match colons in the host name unless it's an v6 address
+    # Allow IPv6 addresses (need to be wrapped in brackets as required by RFC). It is sufficient to check for
+    # a colon, as the regex wouldn't match colons in the host name unless it's an v6 address
     return true if ':' in hostName
 
-    # At this point we have to make a decision. As a heuristic, we check
-    # if the input has dots in it. If yes, and if the last part could be a
-    # TLD, treat it as an URL
+    # At this point we have to make a decision. As a heuristic, we check if the input has dots in it. If yes,
+    # and if the last part could be a TLD, treat it as an URL
     dottedParts = hostName.split '.'
 
     if dottedParts.length > 1

    else
      Utils.createSearchUrl string

# This creates a new function out of an existing function, where the new
# function takes fewer arguments. This allows us to pass around functions
# instead of functions + a partial list of arguments.
Function::curry = ->
  fixedArguments = Array.copy(arguments)
  fn = this


  # Tries to detect if :str is a valid URL.
  isUrl: (str) ->
    # More or less RFC compliant URL host part parsing. This should be sufficient for our needs
    urlRegex = new RegExp(
      # user:password (optional)     => \1, \2
      '^(?:([^:]+)(?::([^:]+))?@)?' +
