MCPcopy Index your code
hub / github.com/TruthHun/BookStack / validateProp

Function validateProp

static/vuejs/vue.runtime.esm.js:1266–1297  ·  view source on GitHub ↗
(
  key,
  propOptions,
  propsData,
  vm
)

Source from the content-addressed store, hash-verified

1264/* */
1265
1266function validateProp (
1267 key,
1268 propOptions,
1269 propsData,
1270 vm
1271) {
1272 var prop = propOptions[key];
1273 var absent = !hasOwn(propsData, key);
1274 var value = propsData[key];
1275 // handle boolean props
1276 if (isType(Boolean, prop.type)) {
1277 if (absent && !hasOwn(prop, 'default')) {
1278 value = false;
1279 } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
1280 value = true;
1281 }
1282 }
1283 // check default value
1284 if (value === undefined) {
1285 value = getPropDefaultValue(vm, prop, key);
1286 // since the default value is a fresh copy,
1287 // make sure to observe it.
1288 var prevShouldConvert = observerState.shouldConvert;
1289 observerState.shouldConvert = true;
1290 observe(value);
1291 observerState.shouldConvert = prevShouldConvert;
1292 }
1293 if (process.env.NODE_ENV !== 'production') {
1294 assertProp(prop, key, value, vm, absent);
1295 }
1296 return value
1297}
1298
1299/**
1300 * Get the default value of a prop.

Callers 3

updateChildComponentFunction · 0.70
loopFunction · 0.70

Calls 6

hasOwnFunction · 0.70
isTypeFunction · 0.70
getPropDefaultValueFunction · 0.70
observeFunction · 0.70
assertPropFunction · 0.70
hyphenateFunction · 0.50

Tested by

no test coverage detected