@contember/utilities 2.0.0-alpha.16 → 2.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +6 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +6 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/structures/BijectiveIndexedMap.cjs +116 -0
- package/dist/development/src/structures/BijectiveIndexedMap.cjs.map +1 -0
- package/dist/development/src/structures/BijectiveIndexedMap.js +116 -0
- package/dist/development/src/structures/BijectiveIndexedMap.js.map +1 -0
- package/dist/development/src/structures/LRUCache.cjs +32 -0
- package/dist/development/src/structures/LRUCache.cjs.map +1 -0
- package/dist/development/src/structures/LRUCache.js +32 -0
- package/dist/development/src/structures/LRUCache.js.map +1 -0
- package/dist/development/src/structures/WeakIdCache.cjs +30 -0
- package/dist/development/src/structures/WeakIdCache.cjs.map +1 -0
- package/dist/development/src/structures/WeakIdCache.js +30 -0
- package/dist/development/src/structures/WeakIdCache.js.map +1 -0
- package/dist/production/index.cjs +6 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +6 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/structures/BijectiveIndexedMap.cjs +116 -0
- package/dist/production/src/structures/BijectiveIndexedMap.cjs.map +1 -0
- package/dist/production/src/structures/BijectiveIndexedMap.js +116 -0
- package/dist/production/src/structures/BijectiveIndexedMap.js.map +1 -0
- package/dist/production/src/structures/LRUCache.cjs +32 -0
- package/dist/production/src/structures/LRUCache.cjs.map +1 -0
- package/dist/production/src/structures/LRUCache.js +32 -0
- package/dist/production/src/structures/LRUCache.js.map +1 -0
- package/dist/production/src/structures/WeakIdCache.cjs +30 -0
- package/dist/production/src/structures/WeakIdCache.cjs.map +1 -0
- package/dist/production/src/structures/WeakIdCache.js +30 -0
- package/dist/production/src/structures/WeakIdCache.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/structures/BijectiveIndexedMap.d.ts +24 -0
- package/dist/types/structures/BijectiveIndexedMap.d.ts.map +1 -0
- package/dist/types/structures/LRUCache.d.ts +9 -0
- package/dist/types/structures/LRUCache.d.ts.map +1 -0
- package/dist/types/structures/WeakIdCache.d.ts +9 -0
- package/dist/types/structures/WeakIdCache.d.ts.map +1 -0
- package/dist/types/structures/index.d.ts +4 -0
- package/dist/types/structures/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/structures/BijectiveIndexedMap.ts +137 -0
- package/src/structures/LRUCache.ts +29 -0
- package/src/structures/WeakIdCache.ts +25 -0
- package/src/structures/index.ts +3 -0
|
@@ -18,6 +18,9 @@ const omit = require("./src/functional/omit.cjs");
|
|
|
18
18
|
const pick = require("./src/functional/pick.cjs");
|
|
19
19
|
const range = require("./src/functional/range.cjs");
|
|
20
20
|
const kebabCase = require("./src/string-utilities/kebabCase.cjs");
|
|
21
|
+
const BijectiveIndexedMap = require("./src/structures/BijectiveIndexedMap.cjs");
|
|
22
|
+
const LRUCache = require("./src/structures/LRUCache.cjs");
|
|
23
|
+
const WeakIdCache = require("./src/structures/WeakIdCache.cjs");
|
|
21
24
|
exports.AssertionError = AssertionError.AssertionError;
|
|
22
25
|
exports.isNonNegativeNumber = Predicates.isNonNegativeNumber;
|
|
23
26
|
exports.assert = assert.assert;
|
|
@@ -37,4 +40,7 @@ exports.omit = omit.omit;
|
|
|
37
40
|
exports.pick = pick.pick;
|
|
38
41
|
exports.range = range.range;
|
|
39
42
|
exports.toKebabCase = kebabCase.toKebabCase;
|
|
43
|
+
exports.BijectiveIndexedMap = BijectiveIndexedMap.BijectiveIndexedMap;
|
|
44
|
+
exports.LRUCache = LRUCache.LRUCache;
|
|
45
|
+
exports.WeakIdCache = WeakIdCache.WeakIdCache;
|
|
40
46
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,8 +16,14 @@ import { omit } from "./src/functional/omit.js";
|
|
|
16
16
|
import { pick } from "./src/functional/pick.js";
|
|
17
17
|
import { range } from "./src/functional/range.js";
|
|
18
18
|
import { toKebabCase } from "./src/string-utilities/kebabCase.js";
|
|
19
|
+
import { BijectiveIndexedMap } from "./src/structures/BijectiveIndexedMap.js";
|
|
20
|
+
import { LRUCache } from "./src/structures/LRUCache.js";
|
|
21
|
+
import { WeakIdCache } from "./src/structures/WeakIdCache.js";
|
|
19
22
|
export {
|
|
20
23
|
AssertionError,
|
|
24
|
+
BijectiveIndexedMap,
|
|
25
|
+
LRUCache,
|
|
26
|
+
WeakIdCache,
|
|
21
27
|
assert,
|
|
22
28
|
assertNever,
|
|
23
29
|
dataAttribute,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
var _a;
|
|
7
|
+
class BijectiveIndexedMap {
|
|
8
|
+
constructor(inverseOrMap) {
|
|
9
|
+
__publicField(this, "valueStore");
|
|
10
|
+
__publicField(this, "index");
|
|
11
|
+
__publicField(this, "indexSeed");
|
|
12
|
+
__publicField(this, "inverse");
|
|
13
|
+
__publicField(this, _a, "BijectiveIndexedMap");
|
|
14
|
+
if (inverseOrMap instanceof BijectiveIndexedMap) {
|
|
15
|
+
this.valueStore = new Map(inverseOrMap.valueStore);
|
|
16
|
+
this.index = new Map(inverseOrMap.index);
|
|
17
|
+
this.indexSeed = inverseOrMap.indexSeed;
|
|
18
|
+
this.inverse = inverseOrMap.inverse;
|
|
19
|
+
} else {
|
|
20
|
+
this.valueStore = /* @__PURE__ */ new Map();
|
|
21
|
+
this.index = /* @__PURE__ */ new Map();
|
|
22
|
+
this.indexSeed = 0;
|
|
23
|
+
this.inverse = inverseOrMap;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
getNewIndex() {
|
|
27
|
+
return this.indexSeed++;
|
|
28
|
+
}
|
|
29
|
+
get size() {
|
|
30
|
+
return this.valueStore.size;
|
|
31
|
+
}
|
|
32
|
+
clear() {
|
|
33
|
+
this.valueStore.clear();
|
|
34
|
+
this.index.clear();
|
|
35
|
+
}
|
|
36
|
+
delete(key) {
|
|
37
|
+
const index = this.index.get(key);
|
|
38
|
+
if (index === void 0) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
this.valueStore.delete(index);
|
|
42
|
+
this.index.delete(key);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
forEach(callback, thisArg) {
|
|
46
|
+
for (const [key, value] of this.entries()) {
|
|
47
|
+
callback.call(thisArg, value, key, this);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
get(key) {
|
|
51
|
+
const index = this.index.get(key);
|
|
52
|
+
if (index === void 0) {
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
return this.valueStore.get(index);
|
|
56
|
+
}
|
|
57
|
+
has(key) {
|
|
58
|
+
return this.index.has(key);
|
|
59
|
+
}
|
|
60
|
+
set(key, value) {
|
|
61
|
+
const existingIndex = this.index.get(key);
|
|
62
|
+
if (existingIndex === void 0) {
|
|
63
|
+
const newIndex = this.getNewIndex();
|
|
64
|
+
this.index.set(key, newIndex);
|
|
65
|
+
this.valueStore.set(newIndex, value);
|
|
66
|
+
} else {
|
|
67
|
+
this.valueStore.set(existingIndex, value);
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
// This doesn't use the inverse in order to avoid confusion.
|
|
72
|
+
// See the description above.
|
|
73
|
+
changeKey(oldKey, newKey) {
|
|
74
|
+
const index = this.index.get(oldKey);
|
|
75
|
+
if (index === void 0) {
|
|
76
|
+
throw new Error();
|
|
77
|
+
}
|
|
78
|
+
this.index.delete(oldKey);
|
|
79
|
+
this.index.set(newKey, index);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
changeKeyOrder(newOrder) {
|
|
83
|
+
for (const key of newOrder) {
|
|
84
|
+
const keyIndex = this.index.get(key);
|
|
85
|
+
if (keyIndex === void 0) {
|
|
86
|
+
throw new Error();
|
|
87
|
+
}
|
|
88
|
+
const value = this.valueStore.get(keyIndex);
|
|
89
|
+
this.valueStore.delete(keyIndex);
|
|
90
|
+
this.valueStore.set(keyIndex, value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
*[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
|
94
|
+
yield* this.entries();
|
|
95
|
+
}
|
|
96
|
+
*entries() {
|
|
97
|
+
for (const value of this.values()) {
|
|
98
|
+
yield [this.inverse(value), value];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
*keys() {
|
|
102
|
+
for (const value of this.values()) {
|
|
103
|
+
yield this.inverse(value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
*values() {
|
|
107
|
+
for (const value of this.valueStore.values()) {
|
|
108
|
+
if (value === void 0) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
yield value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.BijectiveIndexedMap = BijectiveIndexedMap;
|
|
116
|
+
//# sourceMappingURL=BijectiveIndexedMap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): IterableIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): IterableIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): IterableIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAA;AAOO,MAAM,oBAA+C;AAAA,EAWpD,YAAY,cAA6D;AAV/D,kBAAA,MAAA,YAAA;AACA,kBAAA,MAAA,OAAA;AACT,kBAAA,MAAA,WAAA;AAES,kBAAA,MAAA,SAAA;AAEjB,kBAAA,MAAiB,IAAsB,qBAAA;AAKtC,QAAI,wBAAwB,qBAAqB;AAChD,WAAK,aAAa,IAAI,IAAI,aAAa,UAAU;AACjD,WAAK,QAAQ,IAAI,IAAI,aAAa,KAAK;AACvC,WAAK,YAAY,aAAa;AAC9B,WAAK,UAAU,aAAa;AAAA,IAAA,OACtB;AACD,WAAA,iCAAiB;AACjB,WAAA,4BAAY;AACjB,WAAK,YAAY;AACjB,WAAK,UAAU;AAAA,IAChB;AAAA,EACD;AAAA,EAEQ,cAAc;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,IAAW,OAAe;AACzB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,EAEO,QAAc;AACpB,SAAK,WAAW;AAChB,SAAK,MAAM;EACZ;AAAA,EACO,OAAO,KAAiB;AAC9B,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACK,SAAA,WAAW,OAAO,KAAK;AACvB,SAAA,MAAM,OAAO,GAAG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EA,GAlGiB,KAAA,OAAO,aAkGf,OAAO,aAAsC;AACrD,WAAO,KAAK;EACb;AAAA,EAEA,CAAQ,UAAoC;AAChC,eAAA,SAAS,KAAK,UAAU;AAClC,YAAM,CAAC,KAAK,QAAQ,KAAK,GAAG,KAAK;AAAA,IAClC;AAAA,EACD;AAAA,EAEA,CAAQ,OAA4B;AACxB,eAAA,SAAS,KAAK,UAAU;AAC5B,YAAA,KAAK,QAAQ,KAAK;AAAA,IACzB;AAAA,EACD;AAAA,EAEA,CAAQ,SAA8B;AACrC,eAAW,SAAS,KAAK,WAAW,OAAA,GAAU;AAC7C,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AACD;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
var _a;
|
|
5
|
+
class BijectiveIndexedMap {
|
|
6
|
+
constructor(inverseOrMap) {
|
|
7
|
+
__publicField(this, "valueStore");
|
|
8
|
+
__publicField(this, "index");
|
|
9
|
+
__publicField(this, "indexSeed");
|
|
10
|
+
__publicField(this, "inverse");
|
|
11
|
+
__publicField(this, _a, "BijectiveIndexedMap");
|
|
12
|
+
if (inverseOrMap instanceof BijectiveIndexedMap) {
|
|
13
|
+
this.valueStore = new Map(inverseOrMap.valueStore);
|
|
14
|
+
this.index = new Map(inverseOrMap.index);
|
|
15
|
+
this.indexSeed = inverseOrMap.indexSeed;
|
|
16
|
+
this.inverse = inverseOrMap.inverse;
|
|
17
|
+
} else {
|
|
18
|
+
this.valueStore = /* @__PURE__ */ new Map();
|
|
19
|
+
this.index = /* @__PURE__ */ new Map();
|
|
20
|
+
this.indexSeed = 0;
|
|
21
|
+
this.inverse = inverseOrMap;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
getNewIndex() {
|
|
25
|
+
return this.indexSeed++;
|
|
26
|
+
}
|
|
27
|
+
get size() {
|
|
28
|
+
return this.valueStore.size;
|
|
29
|
+
}
|
|
30
|
+
clear() {
|
|
31
|
+
this.valueStore.clear();
|
|
32
|
+
this.index.clear();
|
|
33
|
+
}
|
|
34
|
+
delete(key) {
|
|
35
|
+
const index = this.index.get(key);
|
|
36
|
+
if (index === void 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
this.valueStore.delete(index);
|
|
40
|
+
this.index.delete(key);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
forEach(callback, thisArg) {
|
|
44
|
+
for (const [key, value] of this.entries()) {
|
|
45
|
+
callback.call(thisArg, value, key, this);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get(key) {
|
|
49
|
+
const index = this.index.get(key);
|
|
50
|
+
if (index === void 0) {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
return this.valueStore.get(index);
|
|
54
|
+
}
|
|
55
|
+
has(key) {
|
|
56
|
+
return this.index.has(key);
|
|
57
|
+
}
|
|
58
|
+
set(key, value) {
|
|
59
|
+
const existingIndex = this.index.get(key);
|
|
60
|
+
if (existingIndex === void 0) {
|
|
61
|
+
const newIndex = this.getNewIndex();
|
|
62
|
+
this.index.set(key, newIndex);
|
|
63
|
+
this.valueStore.set(newIndex, value);
|
|
64
|
+
} else {
|
|
65
|
+
this.valueStore.set(existingIndex, value);
|
|
66
|
+
}
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
// This doesn't use the inverse in order to avoid confusion.
|
|
70
|
+
// See the description above.
|
|
71
|
+
changeKey(oldKey, newKey) {
|
|
72
|
+
const index = this.index.get(oldKey);
|
|
73
|
+
if (index === void 0) {
|
|
74
|
+
throw new Error();
|
|
75
|
+
}
|
|
76
|
+
this.index.delete(oldKey);
|
|
77
|
+
this.index.set(newKey, index);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
changeKeyOrder(newOrder) {
|
|
81
|
+
for (const key of newOrder) {
|
|
82
|
+
const keyIndex = this.index.get(key);
|
|
83
|
+
if (keyIndex === void 0) {
|
|
84
|
+
throw new Error();
|
|
85
|
+
}
|
|
86
|
+
const value = this.valueStore.get(keyIndex);
|
|
87
|
+
this.valueStore.delete(keyIndex);
|
|
88
|
+
this.valueStore.set(keyIndex, value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
*[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
|
92
|
+
yield* this.entries();
|
|
93
|
+
}
|
|
94
|
+
*entries() {
|
|
95
|
+
for (const value of this.values()) {
|
|
96
|
+
yield [this.inverse(value), value];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
*keys() {
|
|
100
|
+
for (const value of this.values()) {
|
|
101
|
+
yield this.inverse(value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
*values() {
|
|
105
|
+
for (const value of this.valueStore.values()) {
|
|
106
|
+
if (value === void 0) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
yield value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
BijectiveIndexedMap
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=BijectiveIndexedMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.js","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): IterableIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): IterableIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): IterableIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;AAAA,IAAA;AAOO,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A,IACP;AAAA,EACD;AACD;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
6
|
+
class LRUCache {
|
|
7
|
+
constructor(maxSize) {
|
|
8
|
+
this.maxSize = maxSize;
|
|
9
|
+
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
10
|
+
}
|
|
11
|
+
get(key) {
|
|
12
|
+
const value = this.cache.get(key);
|
|
13
|
+
if (value !== void 0) {
|
|
14
|
+
this.cache.delete(key);
|
|
15
|
+
this.cache.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
set(key, value) {
|
|
20
|
+
if (this.cache.has(key)) {
|
|
21
|
+
this.cache.delete(key);
|
|
22
|
+
} else if (this.cache.size === this.maxSize) {
|
|
23
|
+
this.cache.delete(this.getOldestKey());
|
|
24
|
+
}
|
|
25
|
+
this.cache.set(key, value);
|
|
26
|
+
}
|
|
27
|
+
getOldestKey() {
|
|
28
|
+
return this.cache.keys().next().value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.LRUCache = LRUCache;
|
|
32
|
+
//# sourceMappingURL=LRUCache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LRUCache.cjs","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value\n\t}\n}\n"],"names":[],"mappings":";;;;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
4
|
+
class LRUCache {
|
|
5
|
+
constructor(maxSize) {
|
|
6
|
+
this.maxSize = maxSize;
|
|
7
|
+
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
8
|
+
}
|
|
9
|
+
get(key) {
|
|
10
|
+
const value = this.cache.get(key);
|
|
11
|
+
if (value !== void 0) {
|
|
12
|
+
this.cache.delete(key);
|
|
13
|
+
this.cache.set(key, value);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
set(key, value) {
|
|
18
|
+
if (this.cache.has(key)) {
|
|
19
|
+
this.cache.delete(key);
|
|
20
|
+
} else if (this.cache.size === this.maxSize) {
|
|
21
|
+
this.cache.delete(this.getOldestKey());
|
|
22
|
+
}
|
|
23
|
+
this.cache.set(key, value);
|
|
24
|
+
}
|
|
25
|
+
getOldestKey() {
|
|
26
|
+
return this.cache.keys().next().value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
LRUCache
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=LRUCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LRUCache.js","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value\n\t}\n}\n"],"names":[],"mappings":";;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
class WeakIdCache {
|
|
7
|
+
constructor() {
|
|
8
|
+
__publicField(this, "cache", /* @__PURE__ */ new WeakMap());
|
|
9
|
+
__publicField(this, "seed", 0);
|
|
10
|
+
__publicField(this, "rootId", this.seedToId(this.seed++));
|
|
11
|
+
}
|
|
12
|
+
getId(key) {
|
|
13
|
+
let existing = this.cache.get(key);
|
|
14
|
+
if (existing === void 0) {
|
|
15
|
+
this.cache.set(key, existing = this.seedToId(this.seed++));
|
|
16
|
+
}
|
|
17
|
+
return existing;
|
|
18
|
+
}
|
|
19
|
+
getOptionalKeyId(key) {
|
|
20
|
+
if (key === void 0) {
|
|
21
|
+
return this.rootId;
|
|
22
|
+
}
|
|
23
|
+
return this.getId(key);
|
|
24
|
+
}
|
|
25
|
+
seedToId(seed) {
|
|
26
|
+
return seed.toFixed(0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.WeakIdCache = WeakIdCache;
|
|
30
|
+
//# sourceMappingURL=WeakIdCache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeakIdCache.cjs","sources":["../../../../../packages/utilities/src/structures/WeakIdCache.ts"],"sourcesContent":["export class WeakIdCache<K extends object> {\n\tprivate readonly cache = new WeakMap<K, string>()\n\tprivate seed = 0\n\tprivate readonly rootId = this.seedToId(this.seed++)\n\n\tpublic getId(key: K): string {\n\t\tlet existing = this.cache.get(key)\n\n\t\tif (existing === undefined) {\n\t\t\tthis.cache.set(key, (existing = this.seedToId(this.seed++)))\n\t\t}\n\t\treturn existing\n\t}\n\n\tpublic getOptionalKeyId(key: K | undefined): string {\n\t\tif (key === undefined) {\n\t\t\treturn this.rootId\n\t\t}\n\t\treturn this.getId(key)\n\t}\n\n\tprivate seedToId(seed: number): string {\n\t\treturn seed.toFixed(0)\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAO,MAAM,YAA8B;AAAA,EAApC,cAAA;AACW,kBAAA,MAAA,6BAAY,QAAmB,CAAA;AAChD,kBAAA,MAAQ,QAAO,CAAA;AACf,kBAAA,MAAiB,UAAS,KAAK,SAAS,KAAK,MAAM,CAAA;AAAA,EAAA;AAAA,EAE5C,MAAM,KAAgB;AAC5B,QAAI,WAAW,KAAK,MAAM,IAAI,GAAG;AAEjC,QAAI,aAAa,QAAW;AACtB,WAAA,MAAM,IAAI,KAAM,WAAW,KAAK,SAAS,KAAK,MAAM,CAAE;AAAA,IAC5D;AACO,WAAA;AAAA,EACR;AAAA,EAEO,iBAAiB,KAA4B;AACnD,QAAI,QAAQ,QAAW;AACtB,aAAO,KAAK;AAAA,IACb;AACO,WAAA,KAAK,MAAM,GAAG;AAAA,EACtB;AAAA,EAEQ,SAAS,MAAsB;AAC/B,WAAA,KAAK,QAAQ,CAAC;AAAA,EACtB;AACD;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
class WeakIdCache {
|
|
5
|
+
constructor() {
|
|
6
|
+
__publicField(this, "cache", /* @__PURE__ */ new WeakMap());
|
|
7
|
+
__publicField(this, "seed", 0);
|
|
8
|
+
__publicField(this, "rootId", this.seedToId(this.seed++));
|
|
9
|
+
}
|
|
10
|
+
getId(key) {
|
|
11
|
+
let existing = this.cache.get(key);
|
|
12
|
+
if (existing === void 0) {
|
|
13
|
+
this.cache.set(key, existing = this.seedToId(this.seed++));
|
|
14
|
+
}
|
|
15
|
+
return existing;
|
|
16
|
+
}
|
|
17
|
+
getOptionalKeyId(key) {
|
|
18
|
+
if (key === void 0) {
|
|
19
|
+
return this.rootId;
|
|
20
|
+
}
|
|
21
|
+
return this.getId(key);
|
|
22
|
+
}
|
|
23
|
+
seedToId(seed) {
|
|
24
|
+
return seed.toFixed(0);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
WeakIdCache
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=WeakIdCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeakIdCache.js","sources":["../../../../../packages/utilities/src/structures/WeakIdCache.ts"],"sourcesContent":["export class WeakIdCache<K extends object> {\n\tprivate readonly cache = new WeakMap<K, string>()\n\tprivate seed = 0\n\tprivate readonly rootId = this.seedToId(this.seed++)\n\n\tpublic getId(key: K): string {\n\t\tlet existing = this.cache.get(key)\n\n\t\tif (existing === undefined) {\n\t\t\tthis.cache.set(key, (existing = this.seedToId(this.seed++)))\n\t\t}\n\t\treturn existing\n\t}\n\n\tpublic getOptionalKeyId(key: K | undefined): string {\n\t\tif (key === undefined) {\n\t\t\treturn this.rootId\n\t\t}\n\t\treturn this.getId(key)\n\t}\n\n\tprivate seedToId(seed: number): string {\n\t\treturn seed.toFixed(0)\n\t}\n}\n"],"names":[],"mappings":";;;AAAO,MAAM,YAA8B;AAAA,EAApC,cAAA;AACW,kBAAA,MAAA,6BAAY,QAAmB,CAAA;AAChD,kBAAA,MAAQ,QAAO,CAAA;AACf,kBAAA,MAAiB,UAAS,KAAK,SAAS,KAAK,MAAM,CAAA;AAAA,EAAA;AAAA,EAE5C,MAAM,KAAgB;AAC5B,QAAI,WAAW,KAAK,MAAM,IAAI,GAAG;AAEjC,QAAI,aAAa,QAAW;AACtB,WAAA,MAAM,IAAI,KAAM,WAAW,KAAK,SAAS,KAAK,MAAM,CAAE;AAAA,IAC5D;AACO,WAAA;AAAA,EACR;AAAA,EAEO,iBAAiB,KAA4B;AACnD,QAAI,QAAQ,QAAW;AACtB,aAAO,KAAK;AAAA,IACb;AACO,WAAA,KAAK,MAAM,GAAG;AAAA,EACtB;AAAA,EAEQ,SAAS,MAAsB;AAC/B,WAAA,KAAK,QAAQ,CAAC;AAAA,EACtB;AACD;"}
|
|
@@ -18,6 +18,9 @@ const omit = require("./src/functional/omit.cjs");
|
|
|
18
18
|
const pick = require("./src/functional/pick.cjs");
|
|
19
19
|
const range = require("./src/functional/range.cjs");
|
|
20
20
|
const kebabCase = require("./src/string-utilities/kebabCase.cjs");
|
|
21
|
+
const BijectiveIndexedMap = require("./src/structures/BijectiveIndexedMap.cjs");
|
|
22
|
+
const LRUCache = require("./src/structures/LRUCache.cjs");
|
|
23
|
+
const WeakIdCache = require("./src/structures/WeakIdCache.cjs");
|
|
21
24
|
exports.AssertionError = AssertionError.AssertionError;
|
|
22
25
|
exports.isNonNegativeNumber = Predicates.isNonNegativeNumber;
|
|
23
26
|
exports.assert = assert.assert;
|
|
@@ -37,4 +40,7 @@ exports.omit = omit.omit;
|
|
|
37
40
|
exports.pick = pick.pick;
|
|
38
41
|
exports.range = range.range;
|
|
39
42
|
exports.toKebabCase = kebabCase.toKebabCase;
|
|
43
|
+
exports.BijectiveIndexedMap = BijectiveIndexedMap.BijectiveIndexedMap;
|
|
44
|
+
exports.LRUCache = LRUCache.LRUCache;
|
|
45
|
+
exports.WeakIdCache = WeakIdCache.WeakIdCache;
|
|
40
46
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -16,8 +16,14 @@ import { omit } from "./src/functional/omit.js";
|
|
|
16
16
|
import { pick } from "./src/functional/pick.js";
|
|
17
17
|
import { range } from "./src/functional/range.js";
|
|
18
18
|
import { toKebabCase } from "./src/string-utilities/kebabCase.js";
|
|
19
|
+
import { BijectiveIndexedMap } from "./src/structures/BijectiveIndexedMap.js";
|
|
20
|
+
import { LRUCache } from "./src/structures/LRUCache.js";
|
|
21
|
+
import { WeakIdCache } from "./src/structures/WeakIdCache.js";
|
|
19
22
|
export {
|
|
20
23
|
AssertionError,
|
|
24
|
+
BijectiveIndexedMap,
|
|
25
|
+
LRUCache,
|
|
26
|
+
WeakIdCache,
|
|
21
27
|
assert,
|
|
22
28
|
assertNever,
|
|
23
29
|
dataAttribute,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
var _a;
|
|
7
|
+
class BijectiveIndexedMap {
|
|
8
|
+
constructor(inverseOrMap) {
|
|
9
|
+
__publicField(this, "valueStore");
|
|
10
|
+
__publicField(this, "index");
|
|
11
|
+
__publicField(this, "indexSeed");
|
|
12
|
+
__publicField(this, "inverse");
|
|
13
|
+
__publicField(this, _a, "BijectiveIndexedMap");
|
|
14
|
+
if (inverseOrMap instanceof BijectiveIndexedMap) {
|
|
15
|
+
this.valueStore = new Map(inverseOrMap.valueStore);
|
|
16
|
+
this.index = new Map(inverseOrMap.index);
|
|
17
|
+
this.indexSeed = inverseOrMap.indexSeed;
|
|
18
|
+
this.inverse = inverseOrMap.inverse;
|
|
19
|
+
} else {
|
|
20
|
+
this.valueStore = /* @__PURE__ */ new Map();
|
|
21
|
+
this.index = /* @__PURE__ */ new Map();
|
|
22
|
+
this.indexSeed = 0;
|
|
23
|
+
this.inverse = inverseOrMap;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
getNewIndex() {
|
|
27
|
+
return this.indexSeed++;
|
|
28
|
+
}
|
|
29
|
+
get size() {
|
|
30
|
+
return this.valueStore.size;
|
|
31
|
+
}
|
|
32
|
+
clear() {
|
|
33
|
+
this.valueStore.clear();
|
|
34
|
+
this.index.clear();
|
|
35
|
+
}
|
|
36
|
+
delete(key) {
|
|
37
|
+
const index = this.index.get(key);
|
|
38
|
+
if (index === void 0) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
this.valueStore.delete(index);
|
|
42
|
+
this.index.delete(key);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
forEach(callback, thisArg) {
|
|
46
|
+
for (const [key, value] of this.entries()) {
|
|
47
|
+
callback.call(thisArg, value, key, this);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
get(key) {
|
|
51
|
+
const index = this.index.get(key);
|
|
52
|
+
if (index === void 0) {
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
return this.valueStore.get(index);
|
|
56
|
+
}
|
|
57
|
+
has(key) {
|
|
58
|
+
return this.index.has(key);
|
|
59
|
+
}
|
|
60
|
+
set(key, value) {
|
|
61
|
+
const existingIndex = this.index.get(key);
|
|
62
|
+
if (existingIndex === void 0) {
|
|
63
|
+
const newIndex = this.getNewIndex();
|
|
64
|
+
this.index.set(key, newIndex);
|
|
65
|
+
this.valueStore.set(newIndex, value);
|
|
66
|
+
} else {
|
|
67
|
+
this.valueStore.set(existingIndex, value);
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
// This doesn't use the inverse in order to avoid confusion.
|
|
72
|
+
// See the description above.
|
|
73
|
+
changeKey(oldKey, newKey) {
|
|
74
|
+
const index = this.index.get(oldKey);
|
|
75
|
+
if (index === void 0) {
|
|
76
|
+
throw new Error();
|
|
77
|
+
}
|
|
78
|
+
this.index.delete(oldKey);
|
|
79
|
+
this.index.set(newKey, index);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
changeKeyOrder(newOrder) {
|
|
83
|
+
for (const key of newOrder) {
|
|
84
|
+
const keyIndex = this.index.get(key);
|
|
85
|
+
if (keyIndex === void 0) {
|
|
86
|
+
throw new Error();
|
|
87
|
+
}
|
|
88
|
+
const value = this.valueStore.get(keyIndex);
|
|
89
|
+
this.valueStore.delete(keyIndex);
|
|
90
|
+
this.valueStore.set(keyIndex, value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
*[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
|
94
|
+
yield* this.entries();
|
|
95
|
+
}
|
|
96
|
+
*entries() {
|
|
97
|
+
for (const value of this.values()) {
|
|
98
|
+
yield [this.inverse(value), value];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
*keys() {
|
|
102
|
+
for (const value of this.values()) {
|
|
103
|
+
yield this.inverse(value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
*values() {
|
|
107
|
+
for (const value of this.valueStore.values()) {
|
|
108
|
+
if (value === void 0) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
yield value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.BijectiveIndexedMap = BijectiveIndexedMap;
|
|
116
|
+
//# sourceMappingURL=BijectiveIndexedMap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): IterableIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): IterableIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): IterableIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAA;AAOO,MAAM,oBAA+C;AAAA,EAWpD,YAAY,cAA6D;AAV/D,kBAAA,MAAA,YAAA;AACA,kBAAA,MAAA,OAAA;AACT,kBAAA,MAAA,WAAA;AAES,kBAAA,MAAA,SAAA;AAEjB,kBAAA,MAAiB,IAAsB,qBAAA;AAKtC,QAAI,wBAAwB,qBAAqB;AAChD,WAAK,aAAa,IAAI,IAAI,aAAa,UAAU;AACjD,WAAK,Q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