]> git.r.bdr.sh - rbdr/dotfiles/blob
a2363fcfc68a03fa5ddefb888e4e170eab37cf96
[rbdr/dotfiles] /
1 // Thanks to Andrew Clover:
2 // http://stackoverflow.com/questions/3561493
3 // /is-there-a-regexp-escape-function-in-javascript
4
5 'use strict';
6
7 var re = /[\-\/\\\^$*+?.()|\[\]{}]/g;
8
9 module.exports = function (str) { return String(str).replace(re, '\\$&'); };