MCPcopy Create free account
hub / github.com/Lobos/react-ui / createShapeTypeChecker

Function createShapeTypeChecker

docs/lib/react.js:12755–12776  ·  view source on GitHub ↗
(shapeTypes)

Source from the content-addressed store, hash-verified

12753}
12754
12755function createShapeTypeChecker(shapeTypes) {
12756 function validate(props, propName, componentName, location, propFullName) {
12757 var propValue = props[propName];
12758 var propType = getPropType(propValue);
12759 if (propType !== 'object') {
12760 var locationName = ReactPropTypeLocationNames[location];
12761 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
12762 }
12763 for (var key in shapeTypes) {
12764 var checker = shapeTypes[key];
12765 if (!checker) {
12766 continue;
12767 }
12768 var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
12769 if (error) {
12770 return error;
12771 }
12772 }
12773 return null;
12774 }
12775 return createChainableTypeChecker(validate);
12776}
12777
12778function isNode(propValue) {
12779 switch (typeof propValue) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…