UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

22 lines (18 loc) 682 B
/** * MSKCC 2021, 2024 */ import { warning } from './warning.js'; const didWarnAboutDeprecation = {}; function deprecateFieldOnObject(object, field, Component, message) { Object.defineProperty(object, field, { enumerable: true, get() { if (!didWarnAboutDeprecation[field]) { process.env.NODE_ENV !== "production" ? warning(false, message || `The ${field} field has been deprecated on the ${object.displayName} object. ` + `Please import and use ${Component.displayName || Component.name || 'the field'} directly.`) : void 0; didWarnAboutDeprecation[field] = true; } return Component; } }); } export { deprecateFieldOnObject };