UNPKG

@carbon/react

Version:

React components for the Carbon Design System

34 lines (28 loc) 905 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 noopFn = require('./noopFn.js'); /** * 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); } } : noopFn.noopFn; exports.warning = warning;