Insane number of adds to setup env and packages

This commit is contained in:
2022-11-07 17:45:54 -05:00
parent 62c2bb73a9
commit 55ecf095a9
3127 changed files with 485223 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
import { Base } from "../../ContainerBase";
declare abstract class HashContainer<K> extends Base {
protected constructor(initBucketNum?: number, hashFunc?: (x: K) => number);
clear(): void;
/**
* @description Iterate over all elements in the container.
* @param callback Callback function like Array.forEach.
*/
abstract forEach(callback: (element: unknown, index: number) => void): void;
/**
* @description Remove the elements of the specified value.
* @param key The element you want to remove.
*/
abstract eraseElementByKey(key: K): void;
/**
* @param key The element you want to find.
* @return Boolean about if the specified element in the hash set.
*/
abstract find(key: K): void;
/**
* @description Using for `for...of` syntax like Array.
*/
abstract [Symbol.iterator](): Generator<K | [K, unknown], void, undefined>;
}
export default HashContainer;

View File

@@ -0,0 +1,62 @@
var __extends = this && this.t || function() {
var extendStatics = function(n, t) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(n, t) {
n.__proto__ = t;
} || function(n, t) {
for (var r in t) if (Object.prototype.hasOwnProperty.call(t, r)) n[r] = t[r];
};
return extendStatics(n, t);
};
return function(n, t) {
if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
extendStatics(n, t);
function __() {
this.constructor = n;
}
n.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
};
}();
import { Base } from "../../ContainerBase";
var HashContainer = function(n) {
__extends(HashContainer, n);
function HashContainer(t, r) {
if (t === void 0) {
t = 16;
}
if (r === void 0) {
r = function(n) {
var t;
if (typeof n !== "string") {
t = JSON.stringify(n);
} else t = n;
var r = 0;
var i = t.length;
for (var e = 0; e < i; e++) {
var o = t.charCodeAt(e);
r = (r << 5) - r + o;
r |= 0;
}
return r >>> 0;
};
}
var i = n.call(this) || this;
if (t < 16 || (t & t - 1) !== 0) {
throw new RangeError("InitBucketNum range error");
}
i.l = i.nn = t;
i.p = r;
return i;
}
HashContainer.prototype.clear = function() {
this.o = 0;
this.l = this.nn;
this.h = [];
};
return HashContainer;
}(Base);
export default HashContainer;