util-url

Methods

(inner) getQueryParamValue(url, queryParam) → {string}

Get query param value from the URL
Parameters:
Name Type Description
url string URL of the page
queryParam string paramto be searched
Since:
  • 0.0.2
Source:
Example
// returns "example"
getQueryParamValue('https://google.com/about?utm_medium=example&browser=Chrome', 'utm_medium');
// returns ""
getQueryParamValue('https://google.com/about?utm_medium=example&browser=Chrome', 'not_present_param');

(inner) isvalidUrl(str) → {boolean}

Check whether the string is a valid URL
Parameters:
Name Type Description
str string
Since:
  • 0.0.2
Source:
Example
// returns true
isvalidUrl('https://google.com/a/b/c?a=123&b=str=c=true');;
// returns true
isvalidUrl('google.com');
// returns false
isvalidUrl('oops/what');

(inner) removeURLParameter(url, parameter) → {string}

Remove queryParam from the url
Parameters:
Name Type Description
url string
parameter string | number query param to be removed
Since:
  • 0.0.2
Source:
Example
// returns "https://google.com/about?notMe=2"
removeURLParameter('https://google.com/about?removeMe=1&notMe=2', 'removeMe');