shell-quote
Advanced tools
Comparing version
{ | ||
"name": "shell-quote", | ||
"description": "quote and parse shell commands", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "James Halliday", |
@@ -11,4 +11,4 @@ 'use strict'; | ||
} | ||
if ((/["\s]/).test(s) && !(/'/).test(s)) { | ||
return "'" + s.replace(/(['\\])/g, '\\$1') + "'"; | ||
if ((/["\s\\]/).test(s) && !(/'/).test(s)) { | ||
return "'" + s.replace(/(['])/g, '\\$1') + "'"; | ||
} | ||
@@ -15,0 +15,0 @@ if ((/["'\s]/).test(s)) { |
@@ -25,3 +25,7 @@ 'use strict'; | ||
t.equal(quote(['a', 1, null, undefined]), 'a 1 null undefined'); | ||
t.equal(quote(['a\\x']), 'a\\\\x'); | ||
t.equal(quote(['a\\x']), "'a\\x'"); | ||
t.equal(quote(['a"b']), '\'a"b\''); | ||
t.equal(quote(['"a"b"']), '\'"a"b"\''); | ||
t.equal(quote(['a\\"b']), '\'a\\"b\''); | ||
t.equal(quote(['a\\b']), '\'a\\b\''); | ||
t.end(); | ||
@@ -49,3 +53,3 @@ }); | ||
var x = '`:\\a\\b'; | ||
t.equal(quote([x]), '\\`\\:\\\\a\\\\b'); | ||
t.equal(quote([x]), "'`:\\a\\b'"); | ||
t.end(); | ||
@@ -52,0 +56,0 @@ }); |
23744
0.87%18
5.88%499
1.42%