warnOnce.js 622 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var environment_1 = require("./environment");
  4. var haveWarned = Object.create({});
  5. function warnOnceInDevelopment(msg, type) {
  6. if (type === void 0) { type = 'warn'; }
  7. if (!environment_1.isProduction() && !haveWarned[msg]) {
  8. if (!environment_1.isTest()) {
  9. haveWarned[msg] = true;
  10. }
  11. if (type === 'error') {
  12. console.error(msg);
  13. }
  14. else {
  15. console.warn(msg);
  16. }
  17. }
  18. }
  19. exports.warnOnceInDevelopment = warnOnceInDevelopment;
  20. //# sourceMappingURL=warnOnce.js.map