UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

26 lines (20 loc) 790 B
/** * MSKCC 2021, 2024 */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var warning = require('./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.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; } }); } exports.deprecateFieldOnObject = deprecateFieldOnObject;