Class: URL

mindsmine. URL

A collection of useful static methods to deal with JavaScript URLs.


new URL()

Since:
  • 3.5.0

Methods


<static> appendQuery(url, param, value)

Appends content to the query string of a URL, handling logic for whether to place a question mark or ampersand.

Parameters:
Name Type Description
url String

The URL to append to.

param String

The parameter key to append to the URL.

value Object

The parameter value to append to the URL.

Since:
  • 3.5.0
See:
Throws:

for Invalid URL or empty arguments

Type
TypeError
Returns:

The resulting URL

Type
String

<static> isValidURL(url)

Returns true if the passed string is a valid URL, false otherwise.

Example Usage:

 mindsmine.URL.isValidURL("http://userid@example.com")       //  true
 mindsmine.URL.isValidURL("www.example.com/main.html")       //  false
Parameters:
Name Type Description
url String

to check

Since:
  • 3.5.0
See:
Returns:

if the string is a valid URL

Type
Boolean