summaryrefslogtreecommitdiffstats
path: root/lib/utils/string.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/string.js')
-rw-r--r--lib/utils/string.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/utils/string.js b/lib/utils/string.js
index 54c4c66..588f4d9 100644
--- a/lib/utils/string.js
+++ b/lib/utils/string.js
@@ -20,7 +20,13 @@ function optionsToShellArgs(options) {
.join(" ");
}
+function escapeRegex(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+}
+
module.exports = {
+ escapeRegex: escapeRegex,
escapeShellArg: escapeShellArg,
- optionsToShellArgs: optionsToShellArgs
+ optionsToShellArgs: optionsToShellArgs,
+ toLowerCase: String.prototype.toLowerCase.call.bind(String.prototype.toLowerCase)
};