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; |