Home / Function/ acceptParams() — express Function Reference

acceptParams() — express Function Reference

Architecture documentation for the acceptParams() function in utils.js from the express codebase.

Entity Profile

Dependency Diagram

graph TD
  b2b6b6ea_434c_9529_c769_a260b648b9fc["acceptParams()"]
  3ac8af46_332f_b556_104a_7f9e1c1de5fb["utils.js"]
  b2b6b6ea_434c_9529_c769_a260b648b9fc -->|defined in| 3ac8af46_332f_b556_104a_7f9e1c1de5fb
  d97dda1a_7ff0_0bc9_c930_9ecfc5e5b0a6["exports()"]
  d97dda1a_7ff0_0bc9_c930_9ecfc5e5b0a6 -->|calls| b2b6b6ea_434c_9529_c769_a260b648b9fc
  style b2b6b6ea_434c_9529_c769_a260b648b9fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/utils.js lines 89–120

function acceptParams (str) {
  var length = str.length;
  var colonIndex = str.indexOf(';');
  var index = colonIndex === -1 ? length : colonIndex;
  var ret = { value: str.slice(0, index).trim(), quality: 1, params: {} };

  while (index < length) {
    var splitIndex = str.indexOf('=', index);
    if (splitIndex === -1) break;

    var colonIndex = str.indexOf(';', index);
    var endIndex = colonIndex === -1 ? length : colonIndex;

    if (splitIndex > endIndex) {
      index = str.lastIndexOf(';', splitIndex - 1) + 1;
      continue;
    }

    var key = str.slice(index, splitIndex).trim();
    var value = str.slice(splitIndex + 1, endIndex).trim();

    if (key === 'q') {
      ret.quality = parseFloat(value);
    } else {
      ret.params[key] = value;
    }

    index = endIndex + 1;
  }

  return ret;
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does acceptParams() do?
acceptParams() is a function in the express codebase, defined in lib/utils.js.
Where is acceptParams() defined?
acceptParams() is defined in lib/utils.js at line 89.
What calls acceptParams()?
acceptParams() is called by 1 function(s): exports.

Analyze Your Own Codebase

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

Try Supermodel Free