MCPcopy Create free account
hub / github.com/plotly/dash / validate

Function validate

dash/deps/prop-types@15.8.1.js:403–418  ·  view source on GitHub ↗
(props, propName, componentName, location, propFullName, secret)

Source from the content-addressed store, hash-verified

401
402 function createPrimitiveTypeChecker(expectedType) {
403 function validate(props, propName, componentName, location, propFullName, secret) {
404 var propValue = props[propName];
405 var propType = getPropType(propValue);
406 if (propType !== expectedType) {
407 // `propValue` being instance of, say, date/regexp, pass the 'object'
408 // check, but we can offer a more precise error message here rather than
409 // 'of type `object`'.
410 var preciseType = getPreciseType(propValue);
411
412 return new PropTypeError(
413 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
414 {expectedType: expectedType}
415 );
416 }
417 return null;
418 }
419 return createChainableTypeChecker(validate);
420 }
421

Callers 1

checkTypeFunction · 0.70

Calls 10

getPreciseTypeFunction · 0.85
getClassNameFunction · 0.85
isNodeFunction · 0.85
invalidValidatorErrorFunction · 0.85
pushMethod · 0.80
keysMethod · 0.80
getPropTypeFunction · 0.70
isValidElementFunction · 0.70
isFunction · 0.70
hasFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…