vcc-ui
Version:
VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.
12 lines • 450 B
JavaScript
/**
We need to create our own version of this, as it's
not possible to combine out-of-the-box PropTypes
with custom function validators.
*/
export var oneOf = function oneOf(validTypes) {
return function (props, propName, componentName) {
if (validTypes.indexOf(props[propName]) === -1) {
return new Error("Invalid prop supplied to '".concat(componentName, "'. Must be one of ['").concat(validTypes.join("', '"), "']."));
}
};
};