diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-27 22:27:59 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-27 22:27:59 +0100 |
commit | d8995200e6802f77de1f0e3699e208695c89b95e (patch) | |
tree | 451b7af168723148e1de81714872b00d47b5fdf8 /lib/utils | |
parent | bc389ab4a1ea9013a869c0b33162fb67bb0d0708 (diff) | |
download | gitbook-d8995200e6802f77de1f0e3699e208695c89b95e.zip gitbook-d8995200e6802f77de1f0e3699e208695c89b95e.tar.gz gitbook-d8995200e6802f77de1f0e3699e208695c89b95e.tar.bz2 |
Add options "shortcuts" for blocks from plugins
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/string.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/utils/string.js b/lib/utils/string.js index 72a9ca0..588f4d9 100644 --- a/lib/utils/string.js +++ b/lib/utils/string.js @@ -20,7 +20,12 @@ function optionsToShellArgs(options) { .join(" "); } +function escapeRegex(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); +} + module.exports = { + escapeRegex: escapeRegex, escapeShellArg: escapeShellArg, optionsToShellArgs: optionsToShellArgs, toLowerCase: String.prototype.toLowerCase.call.bind(String.prototype.toLowerCase) |