Solstice web interface.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
454 B

const checkRequiredThenValidate =
(validator) => (props, propName, componentName, location) => {
if (props[propName] != null) {
return validator(props, propName, componentName, location);
}
return new Error(
`Required prop \`${propName}\` was not specified in ` +
`\`${componentName}\`.`
);
};
export default (validator) => {
validator.isRequired = checkRequiredThenValidate(validator);
return validator;
};