[Pkg-javascript-commits] [node-shell-quote] 102/137: Handle non-strings when quoting

Bastien Roucariès rouca at moszumanska.debian.org
Fri Aug 25 19:19:43 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 d43582741c5599807249c28722487aa86bb16f06
Author: Ryan Graham <ryan at strongloop.com>
Date:   Sun Jul 20 13:52:40 2014 -0700

    Handle non-strings when quoting
---
 index.js      | 2 +-
 test/quote.js | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 8560426..f9803c5 100644
--- a/index.js
+++ b/index.js
@@ -15,7 +15,7 @@ exports.quote = function (xs) {
             return '"' + s.replace(/(["\\$`(){}!#&*|])/g, '\\$1') + '"';
         }
         else {
-            return s.replace(/([\\$`(){}!#&*|])/g, '\\$1');
+            return s.toString().replace(/([\\$`(){}!#&*|])/g, '\\$1');
         }
     }).join(' ');
 };
diff --git a/test/quote.js b/test/quote.js
index 3bff8b5..f1db2ed 100644
--- a/test/quote.js
+++ b/test/quote.js
@@ -12,6 +12,7 @@ test('quote', function (t) {
         '\\$ \\` "\'"'
     );
     t.equal(quote([]), '');
+    t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
     t.end();
 });
 

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