UNPKG

311 BJavaScriptView Raw
1"use strict";
2function escapeRegExp(str) {
3 if (typeof str !== 'string')
4 throw new TypeError('str must be a string!');
5 // http://stackoverflow.com/a/6969486
6 return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
7}
8module.exports = escapeRegExp;
9//# sourceMappingURL=escape_regexp.js.map
\No newline at end of file