|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
452 bytes
|
| Line | |
|---|
| 1 | var isProduction = process.env.NODE_ENV === 'production';
|
|---|
| 2 | var prefix = 'Invariant failed';
|
|---|
| 3 | function invariant(condition, message) {
|
|---|
| 4 | if (condition) {
|
|---|
| 5 | return;
|
|---|
| 6 | }
|
|---|
| 7 | if (isProduction) {
|
|---|
| 8 | throw new Error(prefix);
|
|---|
| 9 | }
|
|---|
| 10 | var provided = typeof message === 'function' ? message() : message;
|
|---|
| 11 | var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|---|
| 12 | throw new Error(value);
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export { invariant as default };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.