Set.js 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. /** PURE_IMPORTS_START ._root PURE_IMPORTS_END */
  2. import { root } from './root';
  3. export function minimalSetImpl() {
  4. // THIS IS NOT a full impl of Set, this is just the minimum
  5. // bits of functionality we need for this library.
  6. return (function () {
  7. function MinimalSet() {
  8. this._values = [];
  9. }
  10. MinimalSet.prototype.add = function (value) {
  11. if (!this.has(value)) {
  12. this._values.push(value);
  13. }
  14. };
  15. MinimalSet.prototype.has = function (value) {
  16. return this._values.indexOf(value) !== -1;
  17. };
  18. Object.defineProperty(MinimalSet.prototype, "size", {
  19. get: function () {
  20. return this._values.length;
  21. },
  22. enumerable: true,
  23. configurable: true
  24. });
  25. MinimalSet.prototype.clear = function () {
  26. this._values.length = 0;
  27. };
  28. return MinimalSet;
  29. }());
  30. }
  31. export var Set = root.Set || /*@__PURE__*/ minimalSetImpl();
  32. //# sourceMappingURL=Set.js.map