Class: Filter

Filter(text)

new Filter(text)

Abstract base class for filters
Parameters:
Name Type Description
text string string representation of the filter
Source:

Members

(static) contentRegExp :RegExp

Regular expression that content filters should match
Type:
  • RegExp
Source:

(static) invalidCSPRegExp :RegExp

Regular expression that matches an invalid Content Security Policy
Type:
  • RegExp
Source:

(static) knownFilters :Map.<string, Filter>

Cache for known filters, maps string representation to filter objects.
Type:
Source:

(static) optionsRegExp :RegExp

Regular expression that options on a RegExp filter should match
Type:
  • RegExp
Source:

text :string

String representation of the filter
Type:
  • string
Source:

type :string

Filter type as a string, e.g. "blocking".
Type:
  • string
Source:

Methods

(static) fromObject(obj) → {Filter}

Deserializes a filter
Parameters:
Name Type Description
obj Object map of serialized properties and their values
Source:
Returns:
filter or null if the filter couldn't be created
Type
Filter

(static) fromText(text) → {Filter}

Creates a filter of correct type from its text representation - does the basic parsing and calls the right constructor then.
Parameters:
Name Type Description
text string as in Filter()
Source:
Returns:
Type
Filter

(static) normalize(text) → {string}

Removes unnecessary whitespaces from filter text, will only return null if the input parameter is null.
Parameters:
Name Type Description
text string
Source:
Returns:
Type
string

serialize() → {string}

Serializes the filter for writing out on disk.
Source:
Yields:
Type
string