[Pkg-javascript-commits] [node-shell-quote] 29/137: cleaner implementation recursing on the double quote case

Bastien Roucariès rouca at moszumanska.debian.org
Fri Aug 25 19:19:36 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 adae66f47cf11bb7a686c98059436f496d881955
Author: James Halliday <mail at substack.net>
Date:   Sun Apr 14 21:17:29 2013 -0700

    cleaner implementation recursing on the double quote case
---
 index.js | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/index.js b/index.js
index 8b339c5..65f663b 100644
--- a/index.js
+++ b/index.js
@@ -30,16 +30,13 @@ exports.parse = function parse (s, env) {
                 .replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
             ;
         }
-        else return s
-            .replace(/(['"])((\\\1|[^\1])*?)\1|[^'"]+/g, function (s, q) {
+        else return s.replace(
+            /(['"])((\\\1|[^\1])*?)\1|[^'"]+/g,
+            function (s, q) {
                 if (/^['"]/.test(s)) return parse(s, env);
-                return s
-                    .replace(/(^|[^\\])\$(\w+)/g, getVar)
-                    .replace(/(^|[^\\])\${(\w+)}/g, getVar)
-                    .replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
-                ;
-            })
-        ;
+                return parse('"' + s + '"', env);
+            }
+        );
     });
     
     function getVar (_, pre, key) {

-- 
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