babel-plugin-local-scoped-modules
Version:
babel-plugin-local-scoped-modules ================ This plugin intends to avoid typing relative paths.Use relative paths like local modules instead.
13 lines (9 loc) • 321 B
JavaScript
//Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
;
var matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
export default string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
return string.replace(matchOperatorsRegex, '\\$&');
};