projects
/
dotfiles
/
.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
7834bf9b24c481efa379fc07679c2d8e3ba85247
[dotfiles/.git]
/
index.js
1
'use strict';
2
3
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
4
5
module.exports = function (str) {
6
if (typeof str !== 'string') {
7
throw new TypeError('Expected a string');
8
}
9
10
return str.replace(matchOperatorsRe, '\\$&');
11
};