Home / Function/ normalizeProps() — vue Function Reference

normalizeProps() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  90973dca_1240_2e26_1a4a_ded8b0574117["normalizeProps()"]
  5c734a8f_efba_819c_28fc_f56bfd6b701f["options.ts"]
  90973dca_1240_2e26_1a4a_ded8b0574117 -->|defined in| 5c734a8f_efba_819c_28fc_f56bfd6b701f
  74488b2b_ad6c_b2c0_5bac_8703e8f1b25e["mergeOptions()"]
  74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|calls| 90973dca_1240_2e26_1a4a_ded8b0574117
  e8b22500_20a5_2e19_4c79_386004841499["warn()"]
  90973dca_1240_2e26_1a4a_ded8b0574117 -->|calls| e8b22500_20a5_2e19_4c79_386004841499
  style 90973dca_1240_2e26_1a4a_ded8b0574117 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