lib/response.js
function stringify (value, replacer, spaces, escape) {
  // v8 checks arguments.length for optimizing simple call
  // https://bugs.chromium.org/p/v8/issues/detail?id=4730
  var json = replacer || spaces
    ? JSON.stringify(value, replacer, spaces)
    : JSON.stringify(value);

  if (escape) {
    json = json.replace(/[<>&]/g, function (c) {
      switch (c.charCodeAt(0)) {
        case 0x3c:
          return '\\u003c'
        case 0x3e:
          return '\\u003e'
        case 0x26:
          return '\\u0026'
        default:
          return c
      }
    })
  }

  return json
}
function stringify (value, replacer, spaces, escape) {
  // v8 checks arguments.length for optimizing simple call
  // https://bugs.chromium.org/p/v8/issues/detail?id=4730
  var json = replacer || spaces
    ? JSON.stringify(value, replacer, spaces)
    : JSON.stringify(value);

  if (escape) {
    json = json.replace(/[<>&]/g, function (c) {
      switch (c.charCodeAt(0)) {
        case 0x3c:
          return '\\u003c'
        case 0x3e:
          return '\\u003e'
        case 0x26:
          return '\\u0026'
        default:
          return c
      }
    })
  }

  return json
}
function stringify ( value , replacer , spaces , escape ) { // v8 checks arguments.length for optimizing simple call // https://bugs.chromium.org/p/v8/issues/detail?id=4730 var json = replacer || spaces ? JSON . stringify ( value , replacer , spaces ) : JSON . stringify ( value ) ; if ( escape ) { json = json . replace ( / [<>&] / g , function ( c ) { switch ( c . charCodeAt ( 0 ) ) { case 0x3c : return '\\u003c' case 0x3e : return '\\u003e' case 0x26 : return '\\u0026' default : return c } } ) } return json }
Stringify JSON, like JSON.stringify, but v8 optimized, with the
ability to escape characters that can trigger HTML sniffing.

@param {*} value
@param {function} replaces
@param {number} spaces
@param {boolean} escape
@returns {string}
@private
Stringify JSON like JSON . stringify but v8 optimized with the ability to escape characters that can trigger HTML sniffing .