webhook/node_modules/escape-string-regexp/index.js

12 lines
226 B
JavaScript
Raw Normal View History

'use strict';
2022-11-10 14:06:47 +01:00
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
module.exports = function (str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
2022-11-10 14:06:47 +01:00
return str.replace(matchOperatorsRe, '\\$&');
};