UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

29 lines (25 loc) 1.01 kB
/** * MSKCC 2021, 2024 */ import { warning } from '../internal/warning.js'; const didWarnAboutDeprecation = {}; function deprecate(propType, message) { function checker(props, propName, componentName) { if (props[propName] === undefined) { return; } if (!didWarnAboutDeprecation[componentName] || !didWarnAboutDeprecation[componentName][propName]) { didWarnAboutDeprecation[componentName] = { ...didWarnAboutDeprecation[componentName], [propName]: true }; process.env.NODE_ENV !== "production" ? warning(false, message || `The prop \`${propName}\` has been deprecated for the ` + `${componentName} component. It will be removed in the next major ` + `release`) : void 0; } 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); } return checker; } export { deprecate as default };