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
  41335b20_70f9_2989_a478_f3e623afbc9a["mergeData()"]
  be875bf5_d2ab_d5b9_2c15_622e17aec1fa["mergeDataOrFn()"]
  be875bf5_d2ab_d5b9_2c15_622e17aec1fa -->|calls| 41335b20_70f9_2989_a478_f3e623afbc9a
  3183ebde_ad80_aeaf_4bd8_296f008a86e3["strats()"]
  3183ebde_ad80_aeaf_4bd8_296f008a86e3 -->|calls| 41335b20_70f9_2989_a478_f3e623afbc9a
  48552ac3_589d_0990_1979_1bd455665b33["hasOwn()"]
  41335b20_70f9_2989_a478_f3e623afbc9a -->|calls| 48552ac3_589d_0990_1979_1bd455665b33
  f3ed2d67_a40e_608d_185e_32b185fb8046["set()"]
  41335b20_70f9_2989_a478_f3e623afbc9a -->|calls| f3ed2d67_a40e_608d_185e_32b185fb8046
  9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e["isPlainObject()"]
  41335b20_70f9_2989_a478_f3e623afbc9a -->|calls| 9fc168ea_48e1_435f_dc4f_5cd5efd8ba0e
  style 41335b20_70f9_2989_a478_f3e623afbc9a 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