Nova-Client/Solar/Launcher/node_modules/escape-string-regexp/index.js

12 lines
236 B
JavaScript
Raw Normal View History

2023-03-19 20:32:58 +01:00
'use strict';
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
module.exports = string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
return string.replace(matchOperatorsRegex, '\\$&');
};