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

Unified Diff: lib/common.js

Issue 29715555: Issue 6447 - Switch to Harmony modules in lib/* (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 6, 2018, 7:42 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/common.js
===================================================================
--- a/lib/common.js
+++ b/lib/common.js
@@ -17,29 +17,27 @@
"use strict";
Manish Jethani 2018/03/06 07:44:52 I'm still getting an ESLint error: "'use strict' i
/**
* Converts raw text into a regular expression string
* @param {string} text the string to convert
* @return {string} regular expression representation of the text
*/
-function textToRegExp(text)
+export function textToRegExp(text)
{
return text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
-exports.textToRegExp = textToRegExp;
-
/**
* Converts filter text into regular expression string
* @param {string} text as in Filter()
* @return {string} regular expression representation of filter text
*/
-function filterToRegExp(text)
+export function filterToRegExp(text)
{
return text
// remove multiple wildcards
.replace(/\*+/g, "*")
// remove anchors following separator placeholder
.replace(/\^\|$/, "^")
// escape special symbols
.replace(/\W/g, "\\$&")
@@ -55,19 +53,17 @@
// process anchor at expression end
.replace(/\\\|$/, "$")
// remove leading wildcards
.replace(/^(\.\*)/, "")
// remove trailing wildcards
.replace(/(\.\*)$/, "");
}
-exports.filterToRegExp = filterToRegExp;
-
-function splitSelector(selector)
+export function splitSelector(selector)
{
if (selector.indexOf(",") == -1)
return [selector];
let selectors = [];
let start = 0;
let level = 0;
let sep = "";
@@ -94,10 +90,8 @@
start = i + 1;
}
}
}
selectors.push(selector.substring(start));
return selectors;
}
-
-exports.splitSelector = splitSelector;
« .eslintrc.json ('K') | « .eslintrc.json ('k') | lib/content/elemHideEmulation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld