18 lines
334 B
JavaScript
18 lines
334 B
JavaScript
'use strict';
|
|
|
|
var isProduction = process.env.NODE_ENV === 'production';
|
|
var prefix = 'Invariant failed';
|
|
function invariant(condition, message) {
|
|
if (condition) {
|
|
return;
|
|
}
|
|
|
|
if (isProduction) {
|
|
throw new Error(prefix);
|
|
} else {
|
|
throw new Error(prefix + ": " + (message || ''));
|
|
}
|
|
}
|
|
|
|
module.exports = invariant;
|