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

  if (parts.port === '') {
    return getDefaultPortByProtocol(parts.protocol)
  }

  // For some reasons, the Promise resolves always to a String (not Number).
  return Promise.resolve(String(parts.port))
}
function lobsangProcessorPort (link) {
  let parts
  try {
    parts = parseUrl(link)
  } catch (error) {
    return Promise.reject(error)
  }

  if (parts.port === '') {
    return getDefaultPortByProtocol(parts.protocol)
  }

  // For some reasons, the Promise resolves always to a String (not Number).
  return Promise.resolve(String(parts.port))
}
@module @lobsangnet/lobsang-processor-port
 
Library to process the port from an URL.

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