项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

15 lines
358 B

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