ShortenerCheck

ShortenerCheck

ShortenerCheck instances check URLs to see if they match a known URL shortener.

Constructor

new ShortenerCheck()

Source:

Methods

check(urls) → {Promise|undefined}

Source:

Check to see if the provided URLs should be considered shortened or not. This method may return a Promise, but is not required to.

Rather than returning a value, this method should modify the CheckedURLs by setting shortened to true if necessary and by adding strings to flags if relevant.

Parameters:
Name Type Description
urls Object.<string, CheckedURL>

The URLs to check.

Returns:

If a Promise is returned, the LinkService will wait until the Promise resolves to consider the URLs checked.

Type
Promise | undefined

getExamples() → {Array.<ExampleURL>|Array.<String>|Array.<URL>}

Source:

Get an array of example URLs that this ShortenerCheck will report as shortened. Used for populating a selection field in testing clients.

The default implementation checks if the ShortenerCheck class has a static array called examples and, if so, returns that.

It is not necessary to provide examples, but examples do make testing easier.

Example
class MyCheck extends ShortenerCheck { };
MyCheck.examples = [
    {title: 'Some Page', url: 'https://example.com/'}
];
Returns:

List of URLs.

Type
Array.<ExampleURL> | Array.<String> | Array.<URL>