Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundlers/getRewireRegExp.js')
-rw-r--r--lib/bundlers/getRewireRegExp.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/bundlers/getRewireRegExp.js b/lib/bundlers/getRewireRegExp.js
new file mode 100644
index 0000000..69e4ef5
--- /dev/null
+++ b/lib/bundlers/getRewireRegExp.js
@@ -0,0 +1,15 @@
+/**
+ * Returns a regular expression that matches all rewire() statements.
+ *
+ * Captures:
+ *
+ * 1. the character before rewire
+ * 2. the path between the parenthesis without quotation marks
+ *
+ * @return {RegExp}
+ */
+function getRewireRegExp() {
+ return /([^a-zA-Z0-9_])rewire\(["'](.+?)["']\)/g;
+}
+
+module.exports = getRewireRegExp; \ No newline at end of file