@opensumi/ide-core-common 3.5.1-next-1733469232.0 → 3.6.1-next-1733711618.0
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/lib/collections.d.ts +30 -0
- package/lib/collections.d.ts.map +1 -0
- package/lib/collections.js +122 -0
- package/lib/collections.js.map +1 -0
- package/lib/const/application.d.ts +1 -1
- package/lib/const/application.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/collections.ts +123 -0
- package/src/const/application.ts +1 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A convenience class for managing a "map of maps" of arbitrary depth
|
|
3
|
+
*/
|
|
4
|
+
export declare class MultiKeyMap<K, V> {
|
|
5
|
+
private readonly keyLength;
|
|
6
|
+
private rootMap;
|
|
7
|
+
constructor(keyLength: number);
|
|
8
|
+
static create<S, T>(keyLength: number, data: [S[], T][]): MultiKeyMap<S, T>;
|
|
9
|
+
set(key: readonly K[], value: V): V | undefined;
|
|
10
|
+
get(key: readonly K[]): V | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether the given key is present in the map
|
|
13
|
+
* @param key the key to test. It can have a length < the key length
|
|
14
|
+
* @returns whether the key exists
|
|
15
|
+
*/
|
|
16
|
+
has(key: readonly K[]): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Deletes the value with the given key from the map
|
|
19
|
+
* @param key the key to remove. It can have a length < the key length
|
|
20
|
+
* @returns whether the key was present in the map
|
|
21
|
+
*/
|
|
22
|
+
delete(key: readonly K[]): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Iterates over all entries in the map. The ordering semantics are like iterating over a map of maps.
|
|
25
|
+
* @param handler Handler for each entry
|
|
26
|
+
*/
|
|
27
|
+
forEach(handler: (value: V, key: K[]) => void): void;
|
|
28
|
+
private doForeach;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,EAAE,CAAC;IAGf,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtC,OAAO,CAAC,OAAO,CAAa;gBAEC,SAAS,EAAE,MAAM;IAE9C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;IAQ3E,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAkB/C,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS;IAcrC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO;IAc/B;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO;IAclC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;IAKpD,OAAO,CAAC,SAAS;CAWlB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MultiKeyMap = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* A convenience class for managing a "map of maps" of arbitrary depth
|
|
21
|
+
*/
|
|
22
|
+
class MultiKeyMap {
|
|
23
|
+
constructor(keyLength) {
|
|
24
|
+
this.keyLength = keyLength;
|
|
25
|
+
this.rootMap = new Map();
|
|
26
|
+
}
|
|
27
|
+
static create(keyLength, data) {
|
|
28
|
+
const result = new MultiKeyMap(keyLength);
|
|
29
|
+
for (const entry of data) {
|
|
30
|
+
result.set(entry[0], entry[1]);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
set(key, value) {
|
|
35
|
+
if (this.keyLength !== key.length) {
|
|
36
|
+
throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`);
|
|
37
|
+
}
|
|
38
|
+
let map = this.rootMap;
|
|
39
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
40
|
+
let existing = map.get(key[i]);
|
|
41
|
+
if (!existing) {
|
|
42
|
+
existing = new Map();
|
|
43
|
+
map.set(key[i], existing);
|
|
44
|
+
}
|
|
45
|
+
map = existing;
|
|
46
|
+
}
|
|
47
|
+
const oldValue = map.get(key[this.keyLength - 1]);
|
|
48
|
+
map.set(key[this.keyLength - 1], value);
|
|
49
|
+
return oldValue;
|
|
50
|
+
}
|
|
51
|
+
get(key) {
|
|
52
|
+
if (this.keyLength !== key.length) {
|
|
53
|
+
throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`);
|
|
54
|
+
}
|
|
55
|
+
let map = this.rootMap;
|
|
56
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
57
|
+
map = map.get(key[i]);
|
|
58
|
+
if (!map) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return map.get(key[this.keyLength - 1]);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether the given key is present in the map
|
|
66
|
+
* @param key the key to test. It can have a length < the key length
|
|
67
|
+
* @returns whether the key exists
|
|
68
|
+
*/
|
|
69
|
+
has(key) {
|
|
70
|
+
if (this.keyLength < key.length) {
|
|
71
|
+
throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`);
|
|
72
|
+
}
|
|
73
|
+
let map = this.rootMap;
|
|
74
|
+
for (let i = 0; i < key.length - 1; i++) {
|
|
75
|
+
map = map.get(key[i]);
|
|
76
|
+
if (!map) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return map.has(key[key.length - 1]);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Deletes the value with the given key from the map
|
|
84
|
+
* @param key the key to remove. It can have a length < the key length
|
|
85
|
+
* @returns whether the key was present in the map
|
|
86
|
+
*/
|
|
87
|
+
delete(key) {
|
|
88
|
+
if (this.keyLength < key.length) {
|
|
89
|
+
throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`);
|
|
90
|
+
}
|
|
91
|
+
let map = this.rootMap;
|
|
92
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
93
|
+
map = map.get(key[i]);
|
|
94
|
+
if (!map) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return map.delete(key[key.length - 1]);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Iterates over all entries in the map. The ordering semantics are like iterating over a map of maps.
|
|
102
|
+
* @param handler Handler for each entry
|
|
103
|
+
*/
|
|
104
|
+
forEach(handler) {
|
|
105
|
+
this.doForeach(handler, this.rootMap, []);
|
|
106
|
+
}
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
doForeach(handler, currentMap, keys) {
|
|
109
|
+
if (keys.length === this.keyLength - 1) {
|
|
110
|
+
currentMap.forEach((v, k) => {
|
|
111
|
+
handler(v, [...keys, k]);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
currentMap.forEach((v, k) => {
|
|
116
|
+
this.doForeach(handler, v, [...keys, k]);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.MultiKeyMap = MultiKeyMap;
|
|
122
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF;;GAEG;AACH,MAAa,WAAW;IAGtB,YAA6B,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QAFtC,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAEqB,CAAC;IAElD,MAAM,CAAC,MAAM,CAAO,SAAiB,EAAE,IAAgB;QACrD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAO,SAAS,CAAC,CAAC;QAChD,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC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|
|
8
8
|
const ACCOUNT_ID = "WWPLOa7vWXCUTSHCfV5FK7Su";
|
|
9
9
|
const MASTER_KEY = "i6rkupqyvC6Bc6CiO0yVLNqq";
|
|
10
10
|
}
|
|
11
|
-
export declare const DEFAULT_VSCODE_ENGINE_VERSION = "1.
|
|
11
|
+
export declare const DEFAULT_VSCODE_ENGINE_VERSION = "1.68.0";
|
|
12
12
|
//# sourceMappingURL=application.d.ts.map
|
package/lib/const/application.js
CHANGED
|
@@ -12,5 +12,5 @@ var DEFAULT_ALIPAY_CLOUD_REGISTRY;
|
|
|
12
12
|
DEFAULT_ALIPAY_CLOUD_REGISTRY.ACCOUNT_ID = 'WWPLOa7vWXCUTSHCfV5FK7Su';
|
|
13
13
|
DEFAULT_ALIPAY_CLOUD_REGISTRY.MASTER_KEY = 'i6rkupqyvC6Bc6CiO0yVLNqq';
|
|
14
14
|
})(DEFAULT_ALIPAY_CLOUD_REGISTRY || (exports.DEFAULT_ALIPAY_CLOUD_REGISTRY = DEFAULT_ALIPAY_CLOUD_REGISTRY = {}));
|
|
15
|
-
exports.DEFAULT_VSCODE_ENGINE_VERSION = '1.
|
|
15
|
+
exports.DEFAULT_VSCODE_ENGINE_VERSION = '1.68.0';
|
|
16
16
|
//# sourceMappingURL=application.js.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;A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AAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -38,4 +38,5 @@ tslib_1.__exportStar(require("./application.lifecycle"), exports);
|
|
|
38
38
|
tslib_1.__exportStar(require("./extension.schema"), exports);
|
|
39
39
|
tslib_1.__exportStar(require("./ai-native"), exports);
|
|
40
40
|
tslib_1.__exportStar(require("./remote-service"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./collections"), exports);
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,kEAAwC;AACxC,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,mDAAyB;AACzB,oDAA0B;AAC1B,iDAAuB;AACvB,qDAA2B;AAC3B,kDAAwB;AACxB,wDAA8B;AAC9B,oDAA0B;AAC1B,oDAA0B;AAC1B,gDAAsB;AACtB,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,sDAA4B;AAC5B,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB;AACxB,gDAAsB;AACtB,uDAA6B;AAC7B,mDAAyB;AACzB,qDAA2B;AAC3B,qDAA2B;AAC3B,kDAAwB;AACxB,sDAA4B;AAC5B,iDAAuB;AACvB,kEAAwC;AACxC,6DAAmC;AACnC,sDAA4B;AAC5B,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,kEAAwC;AACxC,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,mDAAyB;AACzB,oDAA0B;AAC1B,iDAAuB;AACvB,qDAA2B;AAC3B,kDAAwB;AACxB,wDAA8B;AAC9B,oDAA0B;AAC1B,oDAA0B;AAC1B,gDAAsB;AACtB,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,sDAA4B;AAC5B,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB;AACxB,gDAAsB;AACtB,uDAA6B;AAC7B,mDAAyB;AACzB,qDAA2B;AAC3B,qDAA2B;AAC3B,kDAAwB;AACxB,sDAA4B;AAC5B,iDAAuB;AACvB,kEAAwC;AACxC,6DAAmC;AACnC,sDAA4B;AAC5B,2DAAiC;AACjC,wDAA8B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-core-common",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1-next-1733711618.0",
|
|
4
4
|
"description": "@opensumi/ide-core-common",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@opensumi/di": "^1.8.0",
|
|
22
22
|
"@opensumi/events": "^1.0.0",
|
|
23
|
-
"@opensumi/ide-utils": "3.
|
|
23
|
+
"@opensumi/ide-utils": "3.6.1-next-1733711618.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@opensumi/ide-dev-tool": "3.
|
|
26
|
+
"@opensumi/ide-dev-tool": "3.6.1-next-1733711618.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4dc6a9f13d56a9e06bd7b97e70127902d485be1a"
|
|
29
29
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A convenience class for managing a "map of maps" of arbitrary depth
|
|
19
|
+
*/
|
|
20
|
+
export class MultiKeyMap<K, V> {
|
|
21
|
+
private rootMap = new Map();
|
|
22
|
+
|
|
23
|
+
constructor(private readonly keyLength: number) {}
|
|
24
|
+
|
|
25
|
+
static create<S, T>(keyLength: number, data: [S[], T][]): MultiKeyMap<S, T> {
|
|
26
|
+
const result = new MultiKeyMap<S, T>(keyLength);
|
|
27
|
+
for (const entry of data) {
|
|
28
|
+
result.set(entry[0], entry[1]);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
set(key: readonly K[], value: V): V | undefined {
|
|
34
|
+
if (this.keyLength !== key.length) {
|
|
35
|
+
throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`);
|
|
36
|
+
}
|
|
37
|
+
let map = this.rootMap;
|
|
38
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
39
|
+
let existing = map.get(key[i]);
|
|
40
|
+
if (!existing) {
|
|
41
|
+
existing = new Map();
|
|
42
|
+
map.set(key[i], existing);
|
|
43
|
+
}
|
|
44
|
+
map = existing;
|
|
45
|
+
}
|
|
46
|
+
const oldValue = map.get(key[this.keyLength - 1]);
|
|
47
|
+
map.set(key[this.keyLength - 1], value);
|
|
48
|
+
return oldValue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get(key: readonly K[]): V | undefined {
|
|
52
|
+
if (this.keyLength !== key.length) {
|
|
53
|
+
throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`);
|
|
54
|
+
}
|
|
55
|
+
let map = this.rootMap;
|
|
56
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
57
|
+
map = map.get(key[i]);
|
|
58
|
+
if (!map) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return map.get(key[this.keyLength - 1]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks whether the given key is present in the map
|
|
67
|
+
* @param key the key to test. It can have a length < the key length
|
|
68
|
+
* @returns whether the key exists
|
|
69
|
+
*/
|
|
70
|
+
has(key: readonly K[]): boolean {
|
|
71
|
+
if (this.keyLength < key.length) {
|
|
72
|
+
throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`);
|
|
73
|
+
}
|
|
74
|
+
let map = this.rootMap;
|
|
75
|
+
for (let i = 0; i < key.length - 1; i++) {
|
|
76
|
+
map = map.get(key[i]);
|
|
77
|
+
if (!map) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return map.has(key[key.length - 1]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Deletes the value with the given key from the map
|
|
86
|
+
* @param key the key to remove. It can have a length < the key length
|
|
87
|
+
* @returns whether the key was present in the map
|
|
88
|
+
*/
|
|
89
|
+
delete(key: readonly K[]): boolean {
|
|
90
|
+
if (this.keyLength < key.length) {
|
|
91
|
+
throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`);
|
|
92
|
+
}
|
|
93
|
+
let map = this.rootMap;
|
|
94
|
+
for (let i = 0; i < this.keyLength - 1; i++) {
|
|
95
|
+
map = map.get(key[i]);
|
|
96
|
+
if (!map) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return map.delete(key[key.length - 1]);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Iterates over all entries in the map. The ordering semantics are like iterating over a map of maps.
|
|
105
|
+
* @param handler Handler for each entry
|
|
106
|
+
*/
|
|
107
|
+
forEach(handler: (value: V, key: K[]) => void): void {
|
|
108
|
+
this.doForeach(handler, this.rootMap, []);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
|
+
private doForeach(handler: (value: V, key: K[]) => void, currentMap: Map<any, any>, keys: K[]): void {
|
|
113
|
+
if (keys.length === this.keyLength - 1) {
|
|
114
|
+
currentMap.forEach((v, k) => {
|
|
115
|
+
handler(v, [...keys, k]);
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
currentMap.forEach((v, k) => {
|
|
119
|
+
this.doForeach(handler, v, [...keys, k]);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
package/src/const/application.ts
CHANGED
package/src/index.ts
CHANGED