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
  4fb290a9_d45f_12dc_0184_c81185451355["normalizeProps()"]
  e3725706_6a2c_490a_e95e_84ad13fc4e05["mergeOptions()"]
  e3725706_6a2c_490a_e95e_84ad13fc4e05 -->|calls| 4fb290a9_d45f_12dc_0184_c81185451355
  836e9c36_fe18_c1c8_9715_d916891f0517["camelize()"]
  4fb290a9_d45f_12dc_0184_c81185451355 -->|calls| 836e9c36_fe18_c1c8_9715_d916891f0517
  e3484a9f_f8a5_4082_0208_641d58b965c3["warn()"]
  4fb290a9_d45f_12dc_0184_c81185451355 -->|calls| e3484a9f_f8a5_4082_0208_641d58b965c3
  80bfcce4_fe50_33ea_903d_c2ad718873ba["isPlainObject()"]
  4fb290a9_d45f_12dc_0184_c81185451355 -->|calls| 80bfcce4_fe50_33ea_903d_c2ad718873ba
  872a8457_76aa_9dfa_922f_0876e2f9171d["toRawType()"]
  4fb290a9_d45f_12dc_0184_c81185451355 -->|calls| 872a8457_76aa_9dfa_922f_0876e2f9171d
  style 4fb290a9_d45f_12dc_0184_c81185451355 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