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
  e4810382_8c74_bddb_f04c_e8c3ddc8a0e7["mergeData()"]
  9e1a1d94_6eb5_5e4d_50bd_7c95e856185f["mergeDataOrFn()"]
  9e1a1d94_6eb5_5e4d_50bd_7c95e856185f -->|calls| e4810382_8c74_bddb_f04c_e8c3ddc8a0e7
  e1b94d83_39cf_0384_0c5f_0101fd7c94ec["strats()"]
  e1b94d83_39cf_0384_0c5f_0101fd7c94ec -->|calls| e4810382_8c74_bddb_f04c_e8c3ddc8a0e7
  f2fe9306_50d5_675e_2dfa_2c4d78443a49["hasOwn()"]
  e4810382_8c74_bddb_f04c_e8c3ddc8a0e7 -->|calls| f2fe9306_50d5_675e_2dfa_2c4d78443a49
  1c6c2c60_cb0c_a3fc_17fe_30271386e3b6["set()"]
  e4810382_8c74_bddb_f04c_e8c3ddc8a0e7 -->|calls| 1c6c2c60_cb0c_a3fc_17fe_30271386e3b6
  80bfcce4_fe50_33ea_903d_c2ad718873ba["isPlainObject()"]
  e4810382_8c74_bddb_f04c_e8c3ddc8a0e7 -->|calls| 80bfcce4_fe50_33ea_903d_c2ad718873ba
  style e4810382_8c74_bddb_f04c_e8c3ddc8a0e7 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

Frequently Asked Questions

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