mergeDataOrFn() — vue Function Reference
Architecture documentation for the mergeDataOrFn() function in options.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 9e1a1d94_6eb5_5e4d_50bd_7c95e856185f["mergeDataOrFn()"] e1b94d83_39cf_0384_0c5f_0101fd7c94ec["strats()"] e1b94d83_39cf_0384_0c5f_0101fd7c94ec -->|calls| 9e1a1d94_6eb5_5e4d_50bd_7c95e856185f e4810382_8c74_bddb_f04c_e8c3ddc8a0e7["mergeData()"] 9e1a1d94_6eb5_5e4d_50bd_7c95e856185f -->|calls| e4810382_8c74_bddb_f04c_e8c3ddc8a0e7 5af21a52_5316_e857_22eb_dce69bb60268["isFunction()"] 9e1a1d94_6eb5_5e4d_50bd_7c95e856185f -->|calls| 5af21a52_5316_e857_22eb_dce69bb60268 style 9e1a1d94_6eb5_5e4d_50bd_7c95e856185f 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