1 | ;
|
2 |
|
3 | var isProduction = process.env.NODE_ENV === 'production';
|
4 | var prefix = 'Invariant failed';
|
5 | function invariant(condition, message) {
|
6 | if (condition) {
|
7 | return;
|
8 | }
|
9 | if (isProduction) {
|
10 | throw new Error(prefix);
|
11 | }
|
12 | var provided = typeof message === 'function' ? message() : message;
|
13 | var value = provided ? prefix + ": " + provided : prefix;
|
14 | throw new Error(value);
|
15 | }
|
16 |
|
17 | module.exports = invariant;
|