Finished adding JSDoc for src/utils
This commit is contained in:
parent
2303c89bcf
commit
7b8c44158f
12 changed files with 229 additions and 20 deletions
|
|
@ -14,10 +14,15 @@ GNU Affero General Public License for more details.
|
|||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
/**
|
||||
* I won't lie this line was whole-sale ganked from stack overflow like a fucking skid
|
||||
* In my defense I only did it because js-runtime-devs are taking fucking eons to implement RegExp.escape()
|
||||
* This should be replaced once that function becomes available in mainline versions of node.js:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape
|
||||
*
|
||||
* @param {String} string - Regex string to escape
|
||||
* @returns {String} The Escaped String
|
||||
*/
|
||||
module.exports.escapeRegex = function(string){
|
||||
/* I won't lie this line was whole-sale ganked from stack overflow like a fucking skid
|
||||
In my defense I only did it because js-runtime-devs are taking fucking eons to implement RegExp.escape()
|
||||
This should be replaced once that function becomes available in mainline versions of node.js:
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape */
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue