diff options
Diffstat (limited to 'node_modules/escape-string-regexp/index.js')
-rw-r--r-- | node_modules/escape-string-regexp/index.js | 11 |
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 000000000..ac6572cab --- /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, '\\$&'); +}; |