Blame view

node_modules/coa/lib/shell.js 358 Bytes
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  // Generated by CoffeeScript 1.6.3
  exports.unescape = function(w) {
    w = w.charAt(0) === '"' ? w.replace(/^"|([^\\])"$/g, '$1') : w.replace(/\\ /g, ' ');
    return w.replace(/\\("|'|\$|`|\\)/g, '$1');
  };
  
  exports.escape = function(w) {
    w = w.replace(/(["'$`\\])/g, '\\$1');
    if (w.match(/\s+/)) {
      return '"' + w + '"';
    } else {
      return w;
    }
  };