From 70e9eb2a854eb56a3dfa255be12610a722bbe080 Mon Sep 17 00:00:00 2001 From: Jacob Waddell Date: Fri, 20 May 2016 10:48:00 -0700 Subject: [PATCH] Fix escaping for greater than and less than --- index.js | 2 +- test/quote.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 473b3d2..e3811e8 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 8f9c1b8..030ee74 100644 --- a/test/quote.js +++ b/test/quote.js @@ -17,6 +17,7 @@ test('quote', function (t) { 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();