Parse URL

by @pixiebrix

Parse a URL into its components


How to Use

Parse any URL by passing it as an input to this brick. URL components include:

  • port
  • hash
  • host
  • hostname
  • origin
  • protocol
  • search
  • username
  • password
  • pathname
  • searchParams
  • publicSuffix

Image credit: Dmitri Pavlutin


Inputs

Name Required Type Description
url string An absolute or relative URL
base string The base URL to use in cases where the url is a relative URL

Outputs

Name Required Type Description
hash string
host string
port string
origin string
search string
hostname string
password string
pathname string
protocol string
username string
publicSuffix string Public suffix (see https://publicsuffix.org/)
searchParams object

@pixiebrix/parse-url

Version

1.7.16

Created

Aug. 17, 2021

Updated

Oct. 31, 2022