UNPKG

@mui/x-charts

Version:

The community edition of the Charts components (MUI X).

28 lines (26 loc) 769 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clearWarningsCache = clearWarningsCache; exports.warnOnce = warnOnce; const warnedOnceCache = new Set(); // TODO move to @mui/x-internals // TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper. function warnOnce(message, gravity = 'warning') { if (process.env.NODE_ENV === 'production') { return; } const cleanMessage = Array.isArray(message) ? message.join('\n') : message; if (!warnedOnceCache.has(cleanMessage)) { warnedOnceCache.add(cleanMessage); if (gravity === 'error') { console.error(cleanMessage); } else { console.warn(cleanMessage); } } } function clearWarningsCache() { warnedOnceCache.clear(); }