UNPKG

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.

15 lines (14 loc) 420 B
/** 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 const oneOf = validTypes => (props, propName, componentName) => { if (validTypes.indexOf(props[propName]) === -1) { return new Error( `Invalid prop supplied to '${componentName}'. Must be one of ['${validTypes.join( "', '" )}'].` ); } };