Home / Function/ stringify() — express Function Reference

stringify() — express Function Reference

Architecture documentation for the stringify() function in response.js from the express codebase.

Entity Profile

Dependency Diagram

graph TD
  3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16["stringify()"]
  e8de3182_7771_c885_d297_ca4255bae3a6["response.js"]
  3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16 -->|defined in| e8de3182_7771_c885_d297_ca4255bae3a6
  654363af_a1b9_0807_17be_896895e23cd5["res()"]
  654363af_a1b9_0807_17be_896895e23cd5 -->|calls| 3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16
  style 3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/response.js lines 1023–1047

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 && typeof json === 'string') {
    json = json.replace(/[<>&]/g, function (c) {
      switch (c.charCodeAt(0)) {
        case 0x3c:
          return '\\u003c'
        case 0x3e:
          return '\\u003e'
        case 0x26:
          return '\\u0026'
        /* istanbul ignore next: unreachable default */
        default:
          return c
      }
    })
  }

  return json
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does stringify() do?
stringify() is a function in the express codebase, defined in lib/response.js.
Where is stringify() defined?
stringify() is defined in lib/response.js at line 1023.
What calls stringify()?
stringify() is called by 1 function(s): res.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free