[Pkg-javascript-commits] [node-shell-quote] 01/137: crazy initial thing
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 19:19:34 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 d6469c95adf0172adc65c4adab04910486368ee7
Author: James Halliday <mail at substack.net>
Date: Fri May 18 02:42:19 2012 -0700
crazy initial thing
---
index.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..4cf466f
--- /dev/null
+++ b/index.js
@@ -0,0 +1,17 @@
+exports.quote = function (xs) {
+ return xs.map(function (s) {
+ if (/["\s]/.test(s) && !/'/.test(s)) {
+ return "'" + s.replace(/(['\\])/g, '\\$1') + "'";
+ }
+ else if (/["'\s]/.test(s)) {
+ return '"' + s.replace(/(["\\$`(){}!#&*|])/g, '\\$1') + '"';
+ }
+ else {
+ return s.replace(/([\\$`(){}!#&*|])/g, '\\$1');
+ }
+ }).join(' ');
+};
+
+exports.parse = function (s) {
+ return s.match(/(['"])((\\\1|[^\1])*?)\1|\S+/g);
+};
--
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