[Pkg-javascript-commits] [node-shell-quote] 113/137: Fix some more escaping for .quote()
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 19:19:44 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 ace52f4c8717b370b301a3db3a4727db26e309ad
Author: Jacob Waddell <jacob at Jacobs-Mac-mini.local>
Date: Fri May 20 13:15:37 2016 -0700
Fix some more escaping for .quote()
---
index.js | 2 +-
test/quote.js | 20 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/index.js b/index.js
index e3811e8..730186b 100644
--- a/index.js
+++ b/index.js
@@ -15,7 +15,7 @@ exports.quote = function (xs) {
return '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"';
}
else {
- return String(s).replace(/([\\$`()!#&*|><])/g, '\\$1');
+ return String(s).replace(/([#!"$&'()*,:;<=>?@\[\\\]^`{|}])/g, '\\$1');
}
}).join(' ');
};
diff --git a/test/quote.js b/test/quote.js
index 030ee74..0752ef2 100644
--- a/test/quote.js
+++ b/test/quote.js
@@ -11,16 +11,16 @@ test('quote', function (t) {
quote([ '$', '`', '\'' ]),
'\\$ \\` "\'"'
);
- t.equal(quote([]), '');
- t.equal(quote(["a\nb"]), "'a\nb'");
- t.equal(quote([' #(){}*|][!']), "' #(){}*|][!'");
- t.equal(quote(["'#(){}*|][!"]), '"\'#(){}*|][\\!"');
- t.equal(quote(["X#(){}*|][!"]), "X\\#\\(\\){}\\*\\|][\\!");
- t.equal(quote(["a\n#\nb"]), "'a\n#\nb'");
- t.equal(quote(['><']), '\\>\\<');
- t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
- t.equal(quote([ 'a', 1, null, undefined ]), 'a 1 null undefined');
- t.end();
+ t.equal(quote([]), '');
+ t.equal(quote(["a\nb"]), "'a\nb'");
+ t.equal(quote([' #(){}*|][!']), "' #(){}*|][!'");
+ t.equal(quote(["'#(){}*|][!"]), '"\'#(){}*|][\\!"');
+ t.equal(quote(["X#(){}*|][!"]), "X\\#\\(\\)\\{\\}\\*\\|\\]\\[\\!");
+ t.equal(quote(["a\n#\nb"]), "'a\n#\nb'");
+ t.equal(quote(['><;{}']), '\\>\\<\\;\\{\\}');
+ t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
+ t.equal(quote([ 'a', 1, null, undefined ]), 'a 1 null undefined');
+ t.end();
});
test('quote ops', function (t) {
--
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