Home / Function/ mergeData() — vue Function Reference

mergeData() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9efe5186_8c34_d7d4_88d0_e9a686898b28["mergeData()"]
  5c734a8f_efba_819c_28fc_f56bfd6b701f["options.ts"]
  9efe5186_8c34_d7d4_88d0_e9a686898b28 -->|defined in| 5c734a8f_efba_819c_28fc_f56bfd6b701f
  4f49ac70_a342_d58b_3b5b_116092765886["mergeDataOrFn()"]
  4f49ac70_a342_d58b_3b5b_116092765886 -->|calls| 9efe5186_8c34_d7d4_88d0_e9a686898b28
  b1cf23c1_b9b6_663a_5e34_0711ca6cb0b6["strats()"]
  b1cf23c1_b9b6_663a_5e34_0711ca6cb0b6 -->|calls| 9efe5186_8c34_d7d4_88d0_e9a686898b28
  30a55d4c_1b7d_ce16_2a1e_1bfee103e294["set()"]
  9efe5186_8c34_d7d4_88d0_e9a686898b28 -->|calls| 30a55d4c_1b7d_ce16_2a1e_1bfee103e294
  style 9efe5186_8c34_d7d4_88d0_e9a686898b28 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/util/options.ts lines 52–81

function mergeData(
  to: Record<string | symbol, any>,
  from: Record<string | symbol, any> | null,
  recursive = true
): Record<PropertyKey, any> {
  if (!from) return to
  let key, toVal, fromVal

  const keys = hasSymbol
    ? (Reflect.ownKeys(from) as string[])
    : Object.keys(from)

  for (let i = 0; i < keys.length; i++) {
    key = keys[i]
    // in case the object is already observed...
    if (key === '__ob__') continue
    toVal = to[key]
    fromVal = from[key]
    if (!recursive || !hasOwn(to, key)) {
      set(to, key, fromVal)
    } else if (
      toVal !== fromVal &&
      isPlainObject(toVal) &&
      isPlainObject(fromVal)
    ) {
      mergeData(toVal, fromVal)
    }
  }
  return to
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does mergeData() do?
mergeData() is a function in the vue codebase, defined in src/core/util/options.ts.
Where is mergeData() defined?
mergeData() is defined in src/core/util/options.ts at line 52.
What does mergeData() call?
mergeData() calls 1 function(s): set.
What calls mergeData()?
mergeData() is called by 2 function(s): mergeDataOrFn, strats.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free