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,42 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = void 0;
var _ContainerBase = require("../../ContainerBase");
class HashContainer extends _ContainerBase.Base {
constructor(e = 16, t = (e => {
let t;
if (typeof e !== "string") {
t = JSON.stringify(e);
} else t = e;
let r = 0;
const s = t.length;
for (let e = 0; e < s; e++) {
const s = t.charCodeAt(e);
r = (r << 5) - r + s;
r |= 0;
}
return r >>> 0;
})) {
super();
if (e < 16 || (e & e - 1) !== 0) {
throw new RangeError("InitBucketNum range error");
}
this.u = this.te = e;
this.l = t;
}
clear() {
this.o = 0;
this.u = this.te;
this.i = [];
}
}
var _default = HashContainer;
exports.default = _default;