MCPcopy
hub / github.com/vuejs/core / validateProps

Function validateProps

packages/runtime-core/src/componentProps.ts:653–672  ·  view source on GitHub ↗

* dev only

(
  rawProps: Data,
  props: Data,
  instance: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

651 * dev only
652 */
653function validateProps(
654 rawProps: Data,
655 props: Data,
656 instance: ComponentInternalInstance,
657) {
658 const resolvedValues = toRaw(props)
659 const options = instance.propsOptions[0]
660 const camelizePropsKey = Object.keys(rawProps).map(key => camelize(key))
661 for (const key in options) {
662 let opt = options[key]
663 if (opt == null) continue
664 validateProp(
665 key,
666 resolvedValues[key],
667 opt,
668 __DEV__ ? shallowReadonly(resolvedValues) : resolvedValues,
669 !camelizePropsKey.includes(key),
670 )
671 }
672}
673
674/**
675 * dev only

Callers 2

initPropsFunction · 0.85
updatePropsFunction · 0.85

Calls 4

toRawFunction · 0.90
shallowReadonlyFunction · 0.90
validatePropFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected