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
  bf540967_af11_4bc9_3b8c_e01a05be85df["normalizeProps()"]
  892cde94_b9ea_1f44_2d22_879e0dc87e80["mergeOptions()"]
  892cde94_b9ea_1f44_2d22_879e0dc87e80 -->|calls| bf540967_af11_4bc9_3b8c_e01a05be85df
  447f7b2d_d677_800e_b42e_db97e7d830a7["camelize()"]
  bf540967_af11_4bc9_3b8c_e01a05be85df -->|calls| 447f7b2d_d677_800e_b42e_db97e7d830a7
  a8c8f192_fd2d_dbe3_46ed_dd8fabebc429["warn()"]
  bf540967_af11_4bc9_3b8c_e01a05be85df -->|calls| a8c8f192_fd2d_dbe3_46ed_dd8fabebc429
  9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e["isPlainObject()"]
  bf540967_af11_4bc9_3b8c_e01a05be85df -->|calls| 9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e
  c57c7f31_12a9_617f_4d2b_f5f5170fa30c["toRawType()"]
  bf540967_af11_4bc9_3b8c_e01a05be85df -->|calls| c57c7f31_12a9_617f_4d2b_f5f5170fa30c
  style bf540967_af11_4bc9_3b8c_e01a05be85df 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

Called By

Frequently Asked Questions

What does normalizeProps() do?
normalizeProps() is a function in the vue codebase.
What does normalizeProps() call?
normalizeProps() calls 4 function(s): camelize, isPlainObject, toRawType, 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