summaryrefslogtreecommitdiffstats
path: root/lib/utils/string.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-09 10:43:12 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-09 10:43:12 +0100
commit34fc2831e0cf0fed01c71cec28d93472d87f455b (patch)
treea803cc907c20491ba02863b5d3dd5aedf6bfed10 /lib/utils/string.js
parente1594cde2c32e4ff48f6c4eff3d3d461743d74e1 (diff)
parent1bf68a5aa0703b5a1815cfe4ebb731b5fb6ed9d2 (diff)
downloadgitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.zip
gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.gz
gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.bz2
Merge branch 'version/2.0'
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)
};