Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterValidation.js

Issue 29715577: Issue 6449 - Switch to Harmony modules (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Add lib/.eslintrc.json Created March 6, 2018, 10:30 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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]);
« lib/.eslintrc.json ('K') | « lib/filterComposer.js ('k') | lib/firefoxDataCleanup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld