| Index: lib/filterValidation.js |
| =================================================================== |
| --- a/lib/filterValidation.js |
| +++ b/lib/filterValidation.js |
| @@ -17,6 +17,17 @@ |
| let {Filter, InvalidFilter, ElemHideBase} = require("filterClasses"); |
| +/** |
| + * Parses and validates a filter given by the user. |
| + * |
| + * @param {string} text |
| + * @param {Boolean} [ignore_headers=false] If true, no exception is raised |
| + * for filter list headers, instead |
| + * the function will return null. |
| + * @return {Filter} |
| + * @throws Will throw an exception if filter cannot be |
| + * parsed or contains an invalid CSS selector. |
| + */ |
| function parseFilter(text, ignore_headers) |
| { |
| text = Filter.normalize(text); |
| @@ -58,6 +69,17 @@ |
| } |
| exports.parseFilter = parseFilter; |
| +/** |
| + * Parses and validates a newline-separated list of filters given by the user. |
| + * |
| + * @param {string} text |
| + * @param {Boolean} [ignore_headers=false] If true, filter list headers |
| + * will be stripped instead of |
| + * raising an exception. |
| + * @return {Filter[]} |
| + * @throws Will throw an exception if one of the filters cannot |
| + be parsed or contains an invalid CSS selector. |
| + */ |
| function parseFilters(text, ignore_headers) |
| { |
| let lines = text.split("\n"); |