MCPcopy Create free account
hub / github.com/reactjs/react-rails / validate

Function validate

lib/assets/react-source/development/react-server.js:3978–3993  ·  view source on GitHub ↗
(props, propName, componentName, location, propFullName, secret)

Source from the content-addressed store, hash-verified

3976
3977 function createPrimitiveTypeChecker(expectedType) {
3978 function validate(props, propName, componentName, location, propFullName, secret) {
3979 var propValue = props[propName];
3980 var propType = getPropType(propValue);
3981 if (propType !== expectedType) {
3982 // `propValue` being instance of, say, date/regexp, pass the 'object'
3983 // check, but we can offer a more precise error message here rather than
3984 // 'of type `object`'.
3985 var preciseType = getPreciseType(propValue);
3986
3987 return new PropTypeError(
3988 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3989 {expectedType: expectedType}
3990 );
3991 }
3992 return null;
3993 }
3994 return createChainableTypeChecker(validate);
3995 }
3996

Callers 1

checkTypeFunction · 0.70

Calls 8

hasFunction · 0.85
getPropTypeFunction · 0.70
getPreciseTypeFunction · 0.70
isValidElementFunction · 0.70
getClassNameFunction · 0.70
isFunction · 0.70
isNodeFunction · 0.70
invalidValidatorErrorFunction · 0.70

Tested by

no test coverage detected