tiny-warning.js 595 B

123456789101112131415161718192021222324252627
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global = global || self, global.warning = factory());
  5. }(this, function () { 'use strict';
  6. function warning(condition, message) {
  7. {
  8. if (condition) {
  9. return;
  10. }
  11. var text = "Warning: " + message;
  12. if (typeof console !== 'undefined') {
  13. console.warn(text);
  14. }
  15. try {
  16. throw Error(text);
  17. } catch (x) {}
  18. }
  19. }
  20. return warning;
  21. }));