Skip to content

getPort

getPort(url) → number · URL

Get the port number from a URL string.

  • url (required): URL string
bash
echo '{"url": "https://api.example.com:8443/v1"}' | utlx -e 'getPort($input.url)'
# 8443
utlx
{
  port: getPort($input.url)
}

Released under AGPL-3.0.