Skip to content

Commit

Permalink
quote all ops objects
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed May 13, 2013
1 parent 59fb71b commit ac7be63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
exports.quote = function (xs) {
return xs.map(function (s) {
if (/["\s]/.test(s) && !/'/.test(s)) {
if (s && typeof s === 'object') {
return s.op.replace(/(.)/g, '\\$1');
}
else if (/["\s]/.test(s) && !/'/.test(s)) {
return "'" + s.replace(/(['\\])/g, '\\$1') + "'";
}
else if (/["'\s]/.test(s)) {
Expand Down

0 comments on commit ac7be63

Please sign in to comment.