setup-python/node_modules/escape-string-regexp/index.js
Danny McCormick 39c08a0eaa Initial pass
2019-06-26 21:12:00 -04:00

11 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, '\\$&');
};