mergeDataOrFn() — vue Function Reference
Architecture documentation for the mergeDataOrFn() function in options.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD be875bf5_d2ab_d5b9_2c15_622e17aec1fa["mergeDataOrFn()"] 3183ebde_ad80_aeaf_4bd8_296f008a86e3["strats()"] 3183ebde_ad80_aeaf_4bd8_296f008a86e3 -->|calls| be875bf5_d2ab_d5b9_2c15_622e17aec1fa 41335b20_70f9_2989_a478_f3e623afbc9a["mergeData()"] be875bf5_d2ab_d5b9_2c15_622e17aec1fa -->|calls| 41335b20_70f9_2989_a478_f3e623afbc9a b6885901_8acd_8c4a_af15_cbd768bcd57b["isFunction()"] be875bf5_d2ab_d5b9_2c15_622e17aec1fa -->|calls| b6885901_8acd_8c4a_af15_cbd768bcd57b style be875bf5_d2ab_d5b9_2c15_622e17aec1fa fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/util/options.ts lines 86–126
export function mergeDataOrFn(
parentVal: any,
childVal: any,
vm?: Component
): Function | null {
if (!vm) {
// in a Vue.extend merge, both should be functions
if (!childVal) {
return parentVal
}
if (!parentVal) {
return childVal
}
// when parentVal & childVal are both present,
// we need to return a function that returns the
// merged result of both functions... no need to
// check if parentVal is a function here because
// it has to be a function to pass previous merges.
return function mergedDataFn() {
return mergeData(
isFunction(childVal) ? childVal.call(this, this) : childVal,
isFunction(parentVal) ? parentVal.call(this, this) : parentVal
)
}
} else {
return function mergedInstanceDataFn() {
// instance merge
const instanceData = isFunction(childVal)
? childVal.call(vm, vm)
: childVal
const defaultData = isFunction(parentVal)
? parentVal.call(vm, vm)
: parentVal
if (instanceData) {
return mergeData(instanceData, defaultData)
} else {
return defaultData
}
}
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does mergeDataOrFn() do?
mergeDataOrFn() is a function in the vue codebase.
What does mergeDataOrFn() call?
mergeDataOrFn() calls 2 function(s): isFunction, mergeData.
What calls mergeDataOrFn()?
mergeDataOrFn() is called by 1 function(s): strats.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free