@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
18 lines (15 loc) • 653 B
JavaScript
/**
* MSKCC 2021, 2024
*/
function requiredIfGivenPropIsTruthyV2(name, propType) {
return function check(props, propName, componentName) {
if (process.env.NODE_ENV !== "production" && props[name] === true && props[propName] == null) {
return new Error(`You must provide a value for \`${propName}\` in \`${componentName}\` if \`${name}\` is true.`);
}
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
rest[_key - 3] = arguments[_key];
}
return propType(props, propName, componentName, ...rest);
};
}
export { requiredIfGivenPropIsTruthyV2 as default };