| Index: lib/filterValidation.js |
| =================================================================== |
| --- a/lib/filterValidation.js |
| +++ b/lib/filterValidation.js |
| @@ -12,20 +12,18 @@ |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| /** @module filterValidation */ |
| -"use strict"; |
| - |
| -const {Filter, InvalidFilter, ElemHideBase, ElemHideEmulationFilter} = |
| - require("filterClasses"); |
| +import {Filter, InvalidFilter, ElemHideBase, |
| + ElemHideEmulationFilter} from "filterClasses"; |
| /** |
| * An error returned by |
| * {@link module:filterValidation.parseFilter parseFilter()} or |
| * {@link module:filterValidation.parseFilters parseFilters()} |
| * indicating that a given filter cannot be parsed, |
| * contains an invalid CSS selector or is a filter list header. |
| * |
| @@ -113,24 +111,23 @@ |
| /** |
| * @typedef ParsedFilter |
| * @property {?Filter} [filter] |
| * The parsed filter if it is valid. Or null if the given string is empty. |
| * @property {FilterParsingError} [error] |
| * See {@link module:filterValidation~FilterParsingError FilterParsingError} |
| */ |
| -let parseFilter = |
| /** |
| * Parses and validates a filter given by the user. |
| * |
| * @param {string} text |
| * @return {ParsedFilter} |
| */ |
| -exports.parseFilter = text => |
| +export const parseFilter = text => |
| { |
| let filter = null; |
| text = Filter.normalize(text); |
| if (text) |
| { |
| if (text[0] == "[") |
| return {error: new FilterParsingError("unexpected-filter-list-header")}; |
| @@ -163,17 +160,17 @@ |
| */ |
| /** |
| * Parses and validates a newline-separated list of filters given by the user. |
| * |
| * @param {string} text |
| * @return {ParsedFilters} |
| */ |
| -exports.parseFilters = text => |
| +export const parseFilters = text => |
| { |
| let lines = text.split("\n"); |
| let filters = []; |
| let errors = []; |
| for (let i = 0; i < lines.length; i++) |
| { |
| let {filter, error} = parseFilter(lines[i]); |