Home / Function/ normalizeProps() — vue Function Reference

normalizeProps() — vue Function Reference

Architecture documentation for the normalizeProps() function in options.ts from the vue codebase.

Function typescript VueCore VDom calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  c692d362_18f2_4cd8_b18e_cb7690dc1a63["normalizeProps()"]
  395cc6b0_6f88_f1b1_f5dd_8cdf5c229777["options.ts"]
  c692d362_18f2_4cd8_b18e_cb7690dc1a63 -->|defined in| 395cc6b0_6f88_f1b1_f5dd_8cdf5c229777
  85601896_bdd4_0d52_f164_49f970cbbef3["mergeOptions()"]
  85601896_bdd4_0d52_f164_49f970cbbef3 -->|calls| c692d362_18f2_4cd8_b18e_cb7690dc1a63
  48bc61b1_05ca_3121_50a7_2f02cdcf2f03["warn()"]
  c692d362_18f2_4cd8_b18e_cb7690dc1a63 -->|calls| 48bc61b1_05ca_3121_50a7_2f02cdcf2f03
  style c692d362_18f2_4cd8_b18e_cb7690dc1a63 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/util/options.ts lines 323–353

function normalizeProps(options: Record<string, any>, vm?: Component | null) {
  const props = options.props
  if (!props) return
  const res: Record<string, any> = {}
  let i, val, name
  if (isArray(props)) {
    i = props.length
    while (i--) {
      val = props[i]
      if (typeof val === 'string') {
        name = camelize(val)
        res[name] = { type: null }
      } else if (__DEV__) {
        warn('props must be strings when using array syntax.')
      }
    }
  } else if (isPlainObject(props)) {
    for (const key in props) {
      val = props[key]
      name = camelize(key)
      res[name] = isPlainObject(val) ? val : { type: val }
    }
  } else if (__DEV__) {
    warn(
      `Invalid value for option "props": expected an Array or an Object, ` +
        `but got ${toRawType(props)}.`,
      vm
    )
  }
  options.props = res
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does normalizeProps() do?
normalizeProps() is a function in the vue codebase, defined in src/core/util/options.ts.
Where is normalizeProps() defined?
normalizeProps() is defined in src/core/util/options.ts at line 323.
What does normalizeProps() call?
normalizeProps() calls 1 function(s): warn.
What calls normalizeProps()?
normalizeProps() is called by 1 function(s): mergeOptions.

Analyze Your Own Codebase

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

Try Supermodel Free