UNPKG

@carbon/react

Version:

React components for the Carbon Design System

32 lines (30 loc) 1.03 kB
/** * 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. */ const require_noopFn = require("./noopFn.js"); //#region src/internal/warning.ts /** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ /** * 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 = process.env.NODE_ENV !== "production" ? (condition, message) => { if (typeof message === "undefined") throw new Error("`warning(condition, message)` requires a warning format argument"); if (!condition) console.warn("Warning: " + message); } : require_noopFn.noopFn; //#endregion exports.warning = warning;