|
|
|
@ -1,11 +1,16 @@ |
|
|
|
const checkRequiredThenValidate = (validator) => |
|
|
|
(props, propName, componentName, ...rest) => |
|
|
|
(props, propName, componentName, location) => |
|
|
|
{ |
|
|
|
if (props[propName] !== null) { |
|
|
|
return validator(props, propName, componentName, ...rest); |
|
|
|
return validator(props, propName, componentName, location); |
|
|
|
} |
|
|
|
|
|
|
|
/* global ReactPropTypesLocationNames */ // Pacify ESLint
|
|
|
|
const location_name = ReactPropTypesLocationNames[location]; |
|
|
|
|
|
|
|
return new Error( |
|
|
|
`Missing prop \`${propName}\` not supplied to \`${componentName}\`` |
|
|
|
`Required prop \`${propName}\` was not specified in ` + |
|
|
|
`\`${componentName}\`. Check the render method of \`${location_name}\`.` |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
|