☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added utils.escapeRegexp()
TJ Holowaychukac297ba9ab3b
diff --git a/lib/utils.js b/lib/utils.jsindex 22a942ec..19600def 100644--- a/lib/utils.js+++ b/lib/utils.js@@ -179,6 +179,7 @@ exports.files = function(dir, ret){** @param {String} str* @return {String}+ * @api private*/exports.slug = function(str){@@ -186,4 +187,16 @@ exports.slug = function(str){.toLowerCase().replace(/ +/g, '-').replace(/[^-\w]/g, '');+};++/**+ * Escape regular expression characters in `str`.+ *+ * @param {String} str+ * @return {String}+ * @api private+ */++exports.escapeRegexp = function(str){+ return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");};\ No newline at end of file