cpr.utils.URL

Index

Properties
Name Type Description
hash String
host String Get a host.
hostname String
href String Get the URL representation string.
origin String I get the origin.
password String
pathname String
port String
protocol String
query {[key:string]: String | String[]} Get search parameters in JSON format.
search String Get the search parameter expression.
searchParams URLSearchParams You get a search parameter object from which you can navigate or manipulate search parameters.
username String
Methods
Name Return Type Description
equals Boolean Compare the two URLs for exact matches.
getCopy URL Get the URL copy object.
identicallyEquals Boolean Compare the two URLs for a semantically match.

Constructor

URL(url, baseURL)
Create a new URL object.
Parameters
name type description
url String URL expression.
baseURLoptional Object Base URL expression. It can be a string or a URL object.

Properties

hash
type String
host
type String
get
Get a host.
set
Specify the host.
hostname
type String
href
type String
get
Get the URL representation string.
set
Specify a URL href expression.
origin
type String
readonly
I get the origin.
password
type String
pathname
type String
port
type String
protocol
type String
query
deprecatedThis value is read-only. To perform operations such as editing, please use searchParams.
type {[key:string]: String | String[]}
readonly
Get search parameters in JSON format.
search
type String
get
Get the search parameter expression.
set
Specifies the search parameter expression.
searchParams
type URLSearchParams
readonly
You get a search parameter object from which you can navigate or manipulate search parameters.
username
type String

Methods

equals(other)
Compare the two URLs for exact matches.
Parameters
name type description
other Object URL or string to compare
return Boolean
getCopy()
Get the URL copy object.
return URL
identicallyEquals(other)
Compare the two URLs for a semantically match. Even if the order of search parameters is different, if the contents are the same, it is judged as the same URL.
Parameters
name type description
other Object URL or string to compare
return Boolean