function getDefaultPortByProtocol (rawProtocol) {
  // port-numbers expect no trailing colon
  const protocol = rawProtocol.endsWith(':')
    ? rawProtocol.slice(0, -1)
    : rawProtocol

  // e.g. mailto has no port associated
  // example return value:
  // { port: 80, protocol: 'tcp', description: 'World Wide Web HTTP' }
  const portByProtocol = portNumbers.getPort(protocol)

  return portByProtocol
    ? Promise.resolve(String(portByProtocol.port))
    : Promise.reject(new Error('Has no port'))
}
function getDefaultPortByProtocol (rawProtocol) {
  
  const protocol = rawProtocol.endsWith(':')
    ? rawProtocol.slice(0, -1)
    : rawProtocol

  
  
  
  const portByProtocol = portNumbers.getPort(protocol)

  return portByProtocol
    ? Promise.resolve(String(portByProtocol.port))
    : Promise.reject(new Error('Has no port'))
}
function getDefaultPortByProtocol ( rawProtocol ) { // port-numbers expect no trailing colon const protocol = rawProtocol . endsWith ( ':' ) ? rawProtocol . slice ( 0 , - 1 ) : rawProtocol // e.g. mailto has no port associated // example return value: // { port: 80, protocol: 'tcp', description: 'World Wide Web HTTP' } const portByProtocol = portNumbers . getPort ( protocol ) return portByProtocol ? Promise . resolve ( String ( portByProtocol . port ) ) : Promise . reject ( new Error ( 'Has no port' ) ) }
Helper method to look up port by protocol.

@private
@param {string} rawProtocol - Protocol as returned by url, i.e. with :
@returns {Promise<string|Error>}
Associated port with protocol.
Or an Error if the validation failed (e.g. mailto:).
Helper method to look up port by protocol .