code: function strEscape (str) {
    // Some magic numbers that worked out fine while benchmarking with v8 6.0
    if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) {
      return str
    }
    if (str.length > 100) {
      return str.replace(strEscapeSequencesReplacer, escapeFn)
    }
    var result = ''
    var last = 0
    for (var i = 0; i < str.length; i++) {
      const point = str.charCodeAt(i)
      if (point === 34 || point === 92 || point < 32) {
        if (last === i) {
          result += meta[point]
        } else {
          result += `${str.slice(last, i)}${meta[point]}`
        }
        last = i + 1
      }
    }
    if (last === 0) {
      result = str
    } else if (last !== i) {
      result += str.slice(last)
    }
    return result
  }
docs: Escape control characters, double quotes and the backslash. Note: it is faster to run this only once for a big string instead of only for the parts that it is necessary for. But this is only true if we do not add extra indentation to the string before.