Constructor
new LinkData(url, textopt, descriptionopt)
This constructor throws a ValidationError unless a valid URL is passed.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
url | URL | The link's URL. | |
text | string | <optional> | The link's text, defaults to the URL. |
description | string | <optional> | A description for the link, defaults to the link text. |
- Source
Throws:
A validation error is thrown if an invalid URL is passed.
- Type
- ValidationError
Members
description
- Source
description
- Source
text
- Source
text
- Source
uri
Get the URL as a URI.js object.
- Source
url
- Source
url
Get or set the URL.
- Source
Methods
asPlainObject() → {plainObject}
Get the link data as a plain object of the form:
{
url: 'http://www.bartificer.net/',
text: 'the link text',
description: 'the link description',
uri: {
hostname: 'www.bartificer.net',
path: '/',
hasPath: false
}
}
Note that the uri could contain more fields - it's initialised with output from the URI.parse() function from the URI module.
- Source
Returns:
- Type:
- plainObject