[Pkg-javascript-commits] [node-shell-quote] 26/137: one more test passing with quote recursion
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 e9537b943d89535b38c0777c210b5aa9780349b2
Author: James Halliday <mail at substack.net>
Date: Sun Apr 14 21:05:35 2013 -0700
one more test passing with quote recursion
---
index.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/index.js b/index.js
index 3406d82..799f4b4 100644
--- a/index.js
+++ b/index.js
@@ -12,13 +12,10 @@ exports.quote = function (xs) {
}).join(' ');
};
-var re = {
- chunk: /(['"])((\\\1|[^\1])*?)\1|(\\ |\S)+/g
-};
-
exports.parse = function parse (s, env) {
if (!env) env = {};
- return s.match(re.chunk).map(function (s) {
+ var chunker = /(['"])((\\\1|[^\1])*?)\1|(\\ |\S)+/g;
+ return s.match(chunker).map(function (s) {
if (/^'/.test(s)) {
return s
.replace(/^'|'$/g, '')
@@ -36,6 +33,9 @@ exports.parse = function parse (s, env) {
else return s
.replace(/(^|[^\\])\$(\w+)/g, getVar)
.replace(/(^|[^\\])\${(\w+)}/g, getVar)
+ .replace(/(['"])((\\\1|[^\1])*?)\1/, function (_, q, s) {
+ return parse(s, env);
+ })
.replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
;
});
--
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