module.exports = function(string) {
  return string.replace(/[^]/g, function(character) {
    // Escape all characters not included in SingleStringCharacters and
    // DoubleStringCharacters on
    // http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
    switch (character) {
      case '"':
      case "'":
      case '\\':
        return '\\' + character
      // Four possible LineTerminator characters need to be escaped:
      case '\n':
        return '\\n'
      case '\r':
        return '\\r'
      case '\u2028':
        return '\\u2028'
      case '\u2029':
        return '\\u2029'
      default:
        return character
    }
  })
}

@@ -59,9 +59,28 @@
 e(/%5B
-%5E
+%22'%5C%5C%5Cn%5Cr%5Cu2028%5Cu2029
 %5D/g,
@@ -619,48 +619,8 @@
 29'%0A
-      default:%0A        return character%0A
     

Use much faster implementation