[Pkg-javascript-commits] [node-shell-quote] 42/137: refactored the chunker regex into a string

Bastien Roucariès rouca at moszumanska.debian.org
Fri Aug 25 19:19:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-shell-quote.

commit 0331c7f63077fda116b3c73540b71880538a4391
Author: James Halliday <mail at substack.net>
Date:   Mon May 13 02:59:35 2013 -0700

    refactored the chunker regex into a string
---
 index.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 08afc20..038400f 100644
--- a/index.js
+++ b/index.js
@@ -12,8 +12,16 @@ exports.quote = function (xs) {
     }).join(' ');
 };
 
+var CONTROL = '(?:\\|\\||\\&\\&|;;|\\|\\&[&;()|])';
+var META = '[|&;()<> \\t]';
+
 exports.parse = function parse (s, env) {
-    var chunker = /(['"])((\\\1|[^\1])*?)\1|(\\[ \t&|]|[^\s&|])+|([&|])/g;
+    var chunker = new RegExp(
+        '([\'"])((\\\\\\1|[^\\1])*?)\\1'
+        + '|(\\\\[|&;()<> \\t]|[^\\s&|])+'
+        + '|([&|])',
+        'g'
+    );
     var match = s.match(chunker);
     if (!match) return [];
     if (!env) env = {};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-shell-quote.git



More information about the Pkg-javascript-commits mailing list