(shapeTypes)
| 12666 | } |
| 12667 | |
| 12668 | function createShapeTypeChecker(shapeTypes) { |
| 12669 | function validate(props, propName, componentName, location, propFullName) { |
| 12670 | var propValue = props[propName]; |
| 12671 | var propType = getPropType(propValue); |
| 12672 | if (propType !== 'object') { |
| 12673 | var locationName = ReactPropTypeLocationNames[location]; |
| 12674 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); |
| 12675 | } |
| 12676 | for (var key in shapeTypes) { |
| 12677 | var checker = shapeTypes[key]; |
| 12678 | if (!checker) { |
| 12679 | continue; |
| 12680 | } |
| 12681 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key); |
| 12682 | if (error) { |
| 12683 | return error; |
| 12684 | } |
| 12685 | } |
| 12686 | return null; |
| 12687 | } |
| 12688 | return createChainableTypeChecker(validate); |
| 12689 | } |
| 12690 | |
| 12691 | function isNode(propValue) { |
| 12692 | switch (typeof propValue) { |
nothing calls this directly
no test coverage detected