|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
462 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 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 ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|---|
| 14 | throw new Error(value);
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | module.exports = invariant;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.