1 |
|
2 | const isDev = process.env.NODE_ENV !== 'production';
|
3 |
|
4 | export const warn = (condition: boolean, format: string, ...args: any[]) => {
|
5 | if (isDev && typeof console !== 'undefined' && console.warn) {
|
6 | if (format === undefined) {
|
7 | console.warn('LogUtils requires an error message argument');
|
8 | }
|
9 |
|
10 | if (!condition) {
|
11 | if (format === undefined) {
|
12 | console.warn(
|
13 | 'Minified exception occurred; use the non-minified dev environment ' +
|
14 | 'for the full error message and additional helpful warnings.',
|
15 | );
|
16 | } else {
|
17 | let argIndex = 0;
|
18 |
|
19 | console.warn(format.replace(/%s/g, () => args[argIndex++]));
|
20 | }
|
21 | }
|
22 | }
|
23 | };
|