tiny-invariant.cjs.js 462 B

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