Home / Function/ normalizeInject() — vue Function Reference

normalizeInject() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  10bf3c9d_b0e0_4358_120e_f3836c8d0a41["normalizeInject()"]
  e3725706_6a2c_490a_e95e_84ad13fc4e05["mergeOptions()"]
  e3725706_6a2c_490a_e95e_84ad13fc4e05 -->|calls| 10bf3c9d_b0e0_4358_120e_f3836c8d0a41
  80bfcce4_fe50_33ea_903d_c2ad718873ba["isPlainObject()"]
  10bf3c9d_b0e0_4358_120e_f3836c8d0a41 -->|calls| 80bfcce4_fe50_33ea_903d_c2ad718873ba
  7a0093e3_a58a_af71_971f_488b65897e74["extend()"]
  10bf3c9d_b0e0_4358_120e_f3836c8d0a41 -->|calls| 7a0093e3_a58a_af71_971f_488b65897e74
  e3484a9f_f8a5_4082_0208_641d58b965c3["warn()"]
  10bf3c9d_b0e0_4358_120e_f3836c8d0a41 -->|calls| e3484a9f_f8a5_4082_0208_641d58b965c3
  872a8457_76aa_9dfa_922f_0876e2f9171d["toRawType()"]
  10bf3c9d_b0e0_4358_120e_f3836c8d0a41 -->|calls| 872a8457_76aa_9dfa_922f_0876e2f9171d
  style 10bf3c9d_b0e0_4358_120e_f3836c8d0a41 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/util/options.ts lines 358–380

function normalizeInject(options: Record<string, any>, vm?: Component | null) {
  const inject = options.inject
  if (!inject) return
  const normalized: Record<string, any> = (options.inject = {})
  if (isArray(inject)) {
    for (let i = 0; i < inject.length; i++) {
      normalized[inject[i]] = { from: inject[i] }
    }
  } else if (isPlainObject(inject)) {
    for (const key in inject) {
      const val = inject[key]
      normalized[key] = isPlainObject(val)
        ? extend({ from: key }, val)
        : { from: val }
    }
  } else if (__DEV__) {
    warn(
      `Invalid value for option "inject": expected an Array or an Object, ` +
        `but got ${toRawType(inject)}.`,
      vm
    )
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

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