UNPKG

@carbon/react

Version:

React components for the Carbon Design System

29 lines (23 loc) 951 B
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var warning = require('./warning.js'); const deprecateFieldOnObject = (object, field, Component, message) => { const didWarnAboutDeprecation = {}; 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;