MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / validate

Function validate

bundle.js:9222–9234  ·  view source on GitHub ↗
(props, propName, componentName, location, propFullName, secret)

Source from the content-addressed store, hash-verified

9220
9221 function createPrimitiveTypeChecker(expectedType) {
9222 function validate(props, propName, componentName, location, propFullName, secret) {
9223 var propValue = props[propName];
9224 var propType = getPropType(propValue);
9225 if (propType !== expectedType) {
9226 // `propValue` being instance of, say, date/regexp, pass the 'object'
9227 // check, but we can offer a more precise error message here rather than
9228 // 'of type `object`'.
9229 var preciseType = getPreciseType(propValue);
9230
9231 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
9232 }
9233 return null;
9234 }
9235 return createChainableTypeChecker(validate);
9236 }
9237

Callers 1

checkTypeFunction · 0.70

Calls 6

getPropTypeFunction · 0.70
getPreciseTypeFunction · 0.70
isValidElementFunction · 0.70
getClassNameFunction · 0.70
isFunction · 0.70
isNodeFunction · 0.70

Tested by

no test coverage detected