UNPKG

@carbon/react

Version:

React components for the Carbon Design System

25 lines (23 loc) 735 B
/** * Copyright IBM Corp. 2016, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ //#region src/internal/warning.ts /** * Logs a warning. * * The warning is only logged if the condition is not met and * `process.env.NODE_ENV !== 'production'` is truthy. * * @param condition - Condition to evaluate. * @param message - Warning message. * @throws Error if no `message` is provided. */ const warning = (condition, message) => { if (typeof message === "undefined") throw new Error("`warning(condition, message)` requires a warning format argument"); if (!condition) console.warn("Warning: " + message); }; //#endregion export { warning };