a zip code crypto-currency system good for red ONLY

MapPolyfill.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. export var MapPolyfill = /*@__PURE__*/ (/*@__PURE__*/ function () {
  2. function MapPolyfill() {
  3. this.size = 0;
  4. this._values = [];
  5. this._keys = [];
  6. }
  7. MapPolyfill.prototype.get = function (key) {
  8. var i = this._keys.indexOf(key);
  9. return i === -1 ? undefined : this._values[i];
  10. };
  11. MapPolyfill.prototype.set = function (key, value) {
  12. var i = this._keys.indexOf(key);
  13. if (i === -1) {
  14. this._keys.push(key);
  15. this._values.push(value);
  16. this.size++;
  17. }
  18. else {
  19. this._values[i] = value;
  20. }
  21. return this;
  22. };
  23. MapPolyfill.prototype.delete = function (key) {
  24. var i = this._keys.indexOf(key);
  25. if (i === -1) {
  26. return false;
  27. }
  28. this._values.splice(i, 1);
  29. this._keys.splice(i, 1);
  30. this.size--;
  31. return true;
  32. };
  33. MapPolyfill.prototype.clear = function () {
  34. this._keys.length = 0;
  35. this._values.length = 0;
  36. this.size = 0;
  37. };
  38. MapPolyfill.prototype.forEach = function (cb, thisArg) {
  39. for (var i = 0; i < this.size; i++) {
  40. cb.call(thisArg, this._values[i], this._keys[i]);
  41. }
  42. };
  43. return MapPolyfill;
  44. }());
  45. //# sourceMappingURL=MapPolyfill.js.map