index.js 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "t", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _ContainerBase = require("../../ContainerBase");
  7. class HashContainer extends _ContainerBase.Base {
  8. constructor(e = 16, t = (e => {
  9. let t;
  10. if (typeof e !== "string") {
  11. t = JSON.stringify(e);
  12. } else t = e;
  13. let r = 0;
  14. const s = t.length;
  15. for (let e = 0; e < s; e++) {
  16. const s = t.charCodeAt(e);
  17. r = (r << 5) - r + s;
  18. r |= 0;
  19. }
  20. return r >>> 0;
  21. })) {
  22. super();
  23. if (e < 16 || (e & e - 1) !== 0) {
  24. throw new RangeError("InitBucketNum range error");
  25. }
  26. this.u = this.te = e;
  27. this.l = t;
  28. }
  29. clear() {
  30. this.o = 0;
  31. this.u = this.te;
  32. this.i = [];
  33. }
  34. }
  35. var _default = HashContainer;
  36. exports.default = _default;