aboutsummaryrefslogtreecommitdiff
path: root/node_modules/escape-string-regexp/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/escape-string-regexp/index.js')
-rw-r--r--node_modules/escape-string-regexp/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js
new file mode 100644
index 0000000..7834bf9
--- /dev/null
+++ b/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+
+module.exports = function (str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return str.replace(matchOperatorsRe, '\\$&');
+};