Front end of the Slack clone application.

iterator.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var root_1 = require('../util/root');
  3. function symbolIteratorPonyfill(root) {
  4. var Symbol = root.Symbol;
  5. if (typeof Symbol === 'function') {
  6. if (!Symbol.iterator) {
  7. Symbol.iterator = Symbol('iterator polyfill');
  8. }
  9. return Symbol.iterator;
  10. }
  11. else {
  12. // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
  13. var Set_1 = root.Set;
  14. if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
  15. return '@@iterator';
  16. }
  17. var Map_1 = root.Map;
  18. // required for compatability with es6-shim
  19. if (Map_1) {
  20. var keys = Object.getOwnPropertyNames(Map_1.prototype);
  21. for (var i = 0; i < keys.length; ++i) {
  22. var key = keys[i];
  23. // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
  24. if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
  25. return key;
  26. }
  27. }
  28. }
  29. return '@@iterator';
  30. }
  31. }
  32. exports.symbolIteratorPonyfill = symbolIteratorPonyfill;
  33. exports.iterator = symbolIteratorPonyfill(root_1.root);
  34. /**
  35. * @deprecated use iterator instead
  36. */
  37. exports.$$iterator = exports.iterator;
  38. //# sourceMappingURL=iterator.js.map