Home / Function/ mergeData() — vue Function Reference

mergeData() — vue Function Reference

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

Function typescript VueCore GlobalAPI calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  a46cd6c3_9d19_f5e0_7752_7009a1d4a572["mergeData()"]
  395cc6b0_6f88_f1b1_f5dd_8cdf5c229777["options.ts"]
  a46cd6c3_9d19_f5e0_7752_7009a1d4a572 -->|defined in| 395cc6b0_6f88_f1b1_f5dd_8cdf5c229777
  86004998_27f2_db20_3ae5_d1baa8df7968["mergeDataOrFn()"]
  86004998_27f2_db20_3ae5_d1baa8df7968 -->|calls| a46cd6c3_9d19_f5e0_7752_7009a1d4a572
  400da704_fbee_8793_f946_5579c4ca50dd["strats()"]
  400da704_fbee_8793_f946_5579c4ca50dd -->|calls| a46cd6c3_9d19_f5e0_7752_7009a1d4a572
  3f865d9f_787c_7a50_d9a7_bb5acf03eb88["set()"]
  a46cd6c3_9d19_f5e0_7752_7009a1d4a572 -->|calls| 3f865d9f_787c_7a50_d9a7_bb5acf03eb88
  style a46cd6c3_9d19_f5e0_7752_7009a1d4a572 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