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

Function validateProp

static/vuejs/vue.js:1276–1307  ·  view source on GitHub ↗
(
  key,
  propOptions,
  propsData,
  vm
)

Source from the content-addressed store, hash-verified

1274/* */
1275
1276function validateProp (
1277 key,
1278 propOptions,
1279 propsData,
1280 vm
1281) {
1282 var prop = propOptions[key];
1283 var absent = !hasOwn(propsData, key);
1284 var value = propsData[key];
1285 // handle boolean props
1286 if (isType(Boolean, prop.type)) {
1287 if (absent && !hasOwn(prop, 'default')) {
1288 value = false;
1289 } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
1290 value = true;
1291 }
1292 }
1293 // check default value
1294 if (value === undefined) {
1295 value = getPropDefaultValue(vm, prop, key);
1296 // since the default value is a fresh copy,
1297 // make sure to observe it.
1298 var prevShouldConvert = observerState.shouldConvert;
1299 observerState.shouldConvert = true;
1300 observe(value);
1301 observerState.shouldConvert = prevShouldConvert;
1302 }
1303 {
1304 assertProp(prop, key, value, vm, absent);
1305 }
1306 return value
1307}
1308
1309/**
1310 * 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