validateProp() — vue Function Reference
Architecture documentation for the validateProp() function in props.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 7425417e_e38e_e5e8_6678_47ee9b0e04c2["validateProp()"] ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc["props.ts"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|defined in| ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc 2e0b3ae4_f148_494b_efa7_cd4ea382d92b["getTypeIndex()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| 2e0b3ae4_f148_494b_efa7_cd4ea382d92b 74686ece_4514_c481_91bf_a291bc504ca2["getPropDefaultValue()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| 74686ece_4514_c481_91bf_a291bc504ca2 c9e94feb_048a_387e_29a1_1567a76d119c["toggleObserving()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| c9e94feb_048a_387e_29a1_1567a76d119c b757abbc_61ef_2454_445e_6bb830e92333["observe()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| b757abbc_61ef_2454_445e_6bb830e92333 bdff343d_a655_05a3_a87d_d14305aacd8d["assertProp()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| bdff343d_a655_05a3_a87d_d14305aacd8d style 7425417e_e38e_e5e8_6678_47ee9b0e04c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/util/props.ts lines 22–59
export function validateProp(
key: string,
propOptions: Object,
propsData: Object,
vm?: Component
): any {
const prop = propOptions[key]
const absent = !hasOwn(propsData, key)
let value = propsData[key]
// boolean casting
const booleanIndex = getTypeIndex(Boolean, prop.type)
if (booleanIndex > -1) {
if (absent && !hasOwn(prop, 'default')) {
value = false
} else if (value === '' || value === hyphenate(key)) {
// only cast empty string / same name to boolean if
// boolean has higher priority
const stringIndex = getTypeIndex(String, prop.type)
if (stringIndex < 0 || booleanIndex < stringIndex) {
value = true
}
}
}
// check default value
if (value === undefined) {
value = getPropDefaultValue(vm, prop, key)
// since the default value is a fresh copy,
// make sure to observe it.
const prevShouldObserve = shouldObserve
toggleObserving(true)
observe(value)
toggleObserving(prevShouldObserve)
}
if (__DEV__) {
assertProp(prop, key, value, vm, absent)
}
return value
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does validateProp() do?
validateProp() is a function in the vue codebase, defined in src/core/util/props.ts.
Where is validateProp() defined?
validateProp() is defined in src/core/util/props.ts at line 22.
What does validateProp() call?
validateProp() calls 5 function(s): assertProp, getPropDefaultValue, getTypeIndex, observe, toggleObserving.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free