SimpleSafetyCheck

SimpleSafetyCheck

SimpleSafetyCheck allows you to check single URLs at once using the checkSingle method, while handling iteration over each URL for you.

Constructor

new SimpleSafetyCheck()

Source:
Example
const blacklist = new Set();

blacklist.add('http://www.google.com/');

class BlacklistedURLs extends SimpleSafetyCheck {
    checkSingle(url) {
        return blacklist.has(url.toString());
    }
}

Classes

SimpleSafetyCheck

Methods

checkSingle(url) → {Promise.<(Boolean|String)>|Boolean|String}

Source:

Check to see if the provided URL should be considered safe or not. Returns a truthy value if the URL is flagged as potentially unsafe. Return a string to give a specific reason, otherwise the name of the check will be used.

If this returns a Promise, the Promise will be awaited.

Parameters:
Name Type Description
url URL

The URL to be tested.

Returns:

The result of the safety check.

Type
Promise.<(Boolean|String)> | Boolean | String