shell-quote
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -16,3 +16,3 @@ exports.quote = function (xs) { | ||
exports.parse = function (s) { | ||
return s.match(/(['"])((\\\1|[^\1])*?)\1|\S+/g) | ||
return s.match(/(['"])((\\\1|[^\1])*?)\1|(\\ |\S)+/g) | ||
.map(function (s) { | ||
@@ -31,5 +31,5 @@ if (/^'/.test(s)) { | ||
} | ||
else return s; | ||
else return s.replace(/\\([ "'\\$`(){}!#&*|])/g, '$1'); | ||
}) | ||
; | ||
}; |
{ | ||
"name" : "shell-quote", | ||
"version" : "0.0.0", | ||
"version" : "0.0.1", | ||
"description" : "quote and parse shell commands", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
@@ -6,3 +6,2 @@ var test = require('tap').test; | ||
t.same(parse('a \'b\' "c"'), [ 'a', 'b', 'c' ]); | ||
t.same( | ||
@@ -12,3 +11,6 @@ parse('beep "boop" \'foo bar baz\' "it\'s \\"so\\" groovy"'), | ||
); | ||
t.same(parse('a b\\ c d'), [ 'a', 'b c', 'd' ]); | ||
t.same(parse('\\$beep bo\\`op'), [ '$beep', 'bo`op' ]); | ||
t.end(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3774
64