setup-php/node_modules/escape-string-regexp/index.js
Shivam Mathur 8f9786b73f init
2019-09-06 05:17:43 +05:30

12 lines
226 B
JavaScript

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