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.
21 lines (18 loc) • 572 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.oneOf = void 0;
/**
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.
*/
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("', '"), "']."));
}
};
};
exports.oneOf = oneOf;