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
  badf6762_f5f3_e870_8c0c_c168b9ecca0d["normalizeInject()"]
  892cde94_b9ea_1f44_2d22_879e0dc87e80["mergeOptions()"]
  892cde94_b9ea_1f44_2d22_879e0dc87e80 -->|calls| badf6762_f5f3_e870_8c0c_c168b9ecca0d
  9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e["isPlainObject()"]
  badf6762_f5f3_e870_8c0c_c168b9ecca0d -->|calls| 9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e
  133969d0_a7bd_f1c5_46a3_9fb8fd249583["extend()"]
  badf6762_f5f3_e870_8c0c_c168b9ecca0d -->|calls| 133969d0_a7bd_f1c5_46a3_9fb8fd249583
  a8c8f192_fd2d_dbe3_46ed_dd8fabebc429["warn()"]
  badf6762_f5f3_e870_8c0c_c168b9ecca0d -->|calls| a8c8f192_fd2d_dbe3_46ed_dd8fabebc429
  c57c7f31_12a9_617f_4d2b_f5f5170fa30c["toRawType()"]
  badf6762_f5f3_e870_8c0c_c168b9ecca0d -->|calls| c57c7f31_12a9_617f_4d2b_f5f5170fa30c
  style badf6762_f5f3_e870_8c0c_c168b9ecca0d 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