tiny-invariant.js 551 B

1234567891011121314151617181920
  1. (function (factory) {
  2. typeof define === 'function' && define.amd ? define(factory) :
  3. factory();
  4. }((function () { 'use strict';
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. var isProduction = process.env.NODE_ENV === 'production';
  7. var prefix = 'Invariant failed';
  8. function invariant(condition, message) {
  9. if (condition) {
  10. return;
  11. }
  12. if (isProduction) {
  13. throw new Error(prefix);
  14. }
  15. throw new Error(prefix + ": " + (message || ''));
  16. }
  17. exports.default = invariant;
  18. })));