packages/lobsang-processor-hostname/lib/lobsang-processor-hostname.js
function lobsangProcessorHostname (link) {
  let parts
  try {
    parts = parseUrl(link)
  } catch (error) {
    return Promise.reject(error)
  }

  if (parts.hostname === '') {
    return Promise.reject(new Error('Not an URL'))
  }

  return Promise.resolve(parts.hostname)
}
function lobsangProcessorHostname (link) {
  let parts
  try {
    parts = parseUrl(link)
  } catch (error) {
    return Promise.reject(error)
  }

  if (parts.hostname === '') {
    return Promise.reject(new Error('Not an URL'))
  }

  return Promise.resolve(parts.hostname)
}
@module @lobsangnet/lobsang-processor-hostname
 
Library to process the hostname from an URL.

@public
@param {string} link - The URL to parse.
@returns {Promise<string|Error>}
Promise which resolves to the hostname if it could be parsed.
Or an Error if the validation failed.