@tspro/ts-utils-lib 1.11.0 → 1.13.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/CHANGELOG.md +8 -0
- package/dist/index.d.mts +78 -3
- package/dist/index.d.ts +78 -3
- package/dist/index.js +448 -57
- package/dist/index.mjs +448 -57
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.0] - 2025-10-18
|
|
4
|
+
### Added
|
|
5
|
+
- Added even more functionality to Map1, Map2 and Map3.
|
|
6
|
+
|
|
7
|
+
## [1.12.0] - 2025-10-15
|
|
8
|
+
### Added
|
|
9
|
+
- Added more functionality to Map1, Map2 and Map3.
|
|
10
|
+
|
|
3
11
|
## [1.11.0] - 2025-10-15
|
|
4
12
|
### Added
|
|
5
13
|
- Forgot to build 1.10.0, now added Map1, Map2 and Map3.
|
package/dist/index.d.mts
CHANGED
|
@@ -449,26 +449,101 @@ declare class SmallIntCache<V> {
|
|
|
449
449
|
declare class Map1<KEY1, VALUE> {
|
|
450
450
|
private map1;
|
|
451
451
|
constructor();
|
|
452
|
+
constructor(map1: Map1<KEY1, VALUE>);
|
|
453
|
+
constructor(entries: Iterable<[KEY1, VALUE]>);
|
|
454
|
+
has(key1: KEY1): boolean;
|
|
452
455
|
set(key1: KEY1, value: VALUE): VALUE;
|
|
453
456
|
get(key1: KEY1): VALUE | undefined;
|
|
454
|
-
|
|
457
|
+
getOrDefault(key1: KEY1, defaultValue: VALUE): VALUE;
|
|
458
|
+
getOrCreate(key1: KEY1, creator: () => VALUE): VALUE;
|
|
455
459
|
delete(key1: KEY1): boolean;
|
|
460
|
+
clear(): void;
|
|
461
|
+
get size(): number;
|
|
462
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
|
|
463
|
+
keys(): IterableIterator<KEY1>;
|
|
464
|
+
keysArray(): KEY1[];
|
|
465
|
+
values(): IterableIterator<VALUE>;
|
|
466
|
+
valuesArray(): VALUE[];
|
|
467
|
+
entries(): IterableIterator<[KEY1, VALUE]>;
|
|
468
|
+
entriesArray(): [KEY1, VALUE][];
|
|
469
|
+
[Symbol.iterator](): Generator<[KEY1, VALUE], void, any>;
|
|
470
|
+
clone(): Map1<KEY1, VALUE>;
|
|
471
|
+
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
472
|
+
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
473
|
+
every(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
474
|
+
filter(fn: (value: VALUE, key1: KEY1) => boolean): Map1<KEY1, VALUE>;
|
|
475
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1) => R, init: R): R;
|
|
476
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1) => R): R[];
|
|
477
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1) => R): Map1<KEY1, R>;
|
|
478
|
+
toMap(): Map<KEY1, VALUE>;
|
|
479
|
+
toString(): string;
|
|
456
480
|
}
|
|
457
481
|
declare class Map2<KEY1, KEY2, VALUE> {
|
|
458
482
|
private map1;
|
|
459
483
|
constructor();
|
|
484
|
+
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
485
|
+
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
486
|
+
has(key1: KEY1, key2: KEY2): boolean;
|
|
460
487
|
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
461
488
|
get(key1: KEY1, key2: KEY2): VALUE | undefined;
|
|
462
|
-
|
|
489
|
+
getOrDefault(key1: KEY1, key2: KEY2, defaultValue: VALUE): VALUE;
|
|
490
|
+
getOrCreate(key1: KEY1, key2: KEY2, creator: () => VALUE): VALUE;
|
|
491
|
+
delete(key1: KEY1): boolean;
|
|
463
492
|
delete(key1: KEY1, key2: KEY2): boolean;
|
|
493
|
+
clear(): void;
|
|
494
|
+
get size(): number;
|
|
495
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
496
|
+
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
497
|
+
keysArray(): [KEY1, KEY2][];
|
|
498
|
+
values(): IterableIterator<VALUE>;
|
|
499
|
+
valuesArray(): VALUE[];
|
|
500
|
+
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
501
|
+
entriesArray(): [KEY1, KEY2, VALUE][];
|
|
502
|
+
[Symbol.iterator](): Generator<[KEY1, KEY2, VALUE], void, any>;
|
|
503
|
+
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
504
|
+
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
505
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
506
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
507
|
+
filter(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): Map2<KEY1, KEY2, VALUE>;
|
|
508
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
509
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
510
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): Map2<KEY1, KEY2, R>;
|
|
511
|
+
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
512
|
+
toString(): string;
|
|
464
513
|
}
|
|
465
514
|
declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
466
515
|
private map1;
|
|
467
516
|
constructor();
|
|
517
|
+
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
518
|
+
constructor(map3: Map3<KEY1, KEY2, KEY3, VALUE>);
|
|
519
|
+
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
468
520
|
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
469
521
|
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
470
|
-
|
|
522
|
+
getOrDefault(key1: KEY1, key2: KEY2, key3: KEY3, defaultValue: VALUE): VALUE;
|
|
523
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, creator: () => VALUE): VALUE;
|
|
524
|
+
delete(key1: KEY1): boolean;
|
|
525
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
471
526
|
delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
527
|
+
clear(): void;
|
|
528
|
+
get size(): number;
|
|
529
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
530
|
+
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
531
|
+
keysArray(): [KEY1, KEY2, KEY3][];
|
|
532
|
+
values(): IterableIterator<VALUE>;
|
|
533
|
+
valuesArray(): VALUE[];
|
|
534
|
+
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
535
|
+
entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
|
|
536
|
+
[Symbol.iterator](): Generator<[KEY1, KEY2, KEY3, VALUE], void, any>;
|
|
537
|
+
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
538
|
+
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
539
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
540
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
541
|
+
filter(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
542
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
543
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
544
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): Map3<KEY1, KEY2, KEY3, R>;
|
|
545
|
+
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
546
|
+
toString(): string;
|
|
472
547
|
}
|
|
473
548
|
|
|
474
549
|
export { Assert, Cookies, Device, LRUCache, Map1, Map2, Map3, SmallIntCache, Stack, index as Utils, Vec2 };
|
package/dist/index.d.ts
CHANGED
|
@@ -449,26 +449,101 @@ declare class SmallIntCache<V> {
|
|
|
449
449
|
declare class Map1<KEY1, VALUE> {
|
|
450
450
|
private map1;
|
|
451
451
|
constructor();
|
|
452
|
+
constructor(map1: Map1<KEY1, VALUE>);
|
|
453
|
+
constructor(entries: Iterable<[KEY1, VALUE]>);
|
|
454
|
+
has(key1: KEY1): boolean;
|
|
452
455
|
set(key1: KEY1, value: VALUE): VALUE;
|
|
453
456
|
get(key1: KEY1): VALUE | undefined;
|
|
454
|
-
|
|
457
|
+
getOrDefault(key1: KEY1, defaultValue: VALUE): VALUE;
|
|
458
|
+
getOrCreate(key1: KEY1, creator: () => VALUE): VALUE;
|
|
455
459
|
delete(key1: KEY1): boolean;
|
|
460
|
+
clear(): void;
|
|
461
|
+
get size(): number;
|
|
462
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
|
|
463
|
+
keys(): IterableIterator<KEY1>;
|
|
464
|
+
keysArray(): KEY1[];
|
|
465
|
+
values(): IterableIterator<VALUE>;
|
|
466
|
+
valuesArray(): VALUE[];
|
|
467
|
+
entries(): IterableIterator<[KEY1, VALUE]>;
|
|
468
|
+
entriesArray(): [KEY1, VALUE][];
|
|
469
|
+
[Symbol.iterator](): Generator<[KEY1, VALUE], void, any>;
|
|
470
|
+
clone(): Map1<KEY1, VALUE>;
|
|
471
|
+
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
472
|
+
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
473
|
+
every(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
474
|
+
filter(fn: (value: VALUE, key1: KEY1) => boolean): Map1<KEY1, VALUE>;
|
|
475
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1) => R, init: R): R;
|
|
476
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1) => R): R[];
|
|
477
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1) => R): Map1<KEY1, R>;
|
|
478
|
+
toMap(): Map<KEY1, VALUE>;
|
|
479
|
+
toString(): string;
|
|
456
480
|
}
|
|
457
481
|
declare class Map2<KEY1, KEY2, VALUE> {
|
|
458
482
|
private map1;
|
|
459
483
|
constructor();
|
|
484
|
+
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
485
|
+
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
486
|
+
has(key1: KEY1, key2: KEY2): boolean;
|
|
460
487
|
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
461
488
|
get(key1: KEY1, key2: KEY2): VALUE | undefined;
|
|
462
|
-
|
|
489
|
+
getOrDefault(key1: KEY1, key2: KEY2, defaultValue: VALUE): VALUE;
|
|
490
|
+
getOrCreate(key1: KEY1, key2: KEY2, creator: () => VALUE): VALUE;
|
|
491
|
+
delete(key1: KEY1): boolean;
|
|
463
492
|
delete(key1: KEY1, key2: KEY2): boolean;
|
|
493
|
+
clear(): void;
|
|
494
|
+
get size(): number;
|
|
495
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
496
|
+
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
497
|
+
keysArray(): [KEY1, KEY2][];
|
|
498
|
+
values(): IterableIterator<VALUE>;
|
|
499
|
+
valuesArray(): VALUE[];
|
|
500
|
+
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
501
|
+
entriesArray(): [KEY1, KEY2, VALUE][];
|
|
502
|
+
[Symbol.iterator](): Generator<[KEY1, KEY2, VALUE], void, any>;
|
|
503
|
+
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
504
|
+
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
505
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
506
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
507
|
+
filter(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): Map2<KEY1, KEY2, VALUE>;
|
|
508
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
509
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
510
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): Map2<KEY1, KEY2, R>;
|
|
511
|
+
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
512
|
+
toString(): string;
|
|
464
513
|
}
|
|
465
514
|
declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
466
515
|
private map1;
|
|
467
516
|
constructor();
|
|
517
|
+
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
518
|
+
constructor(map3: Map3<KEY1, KEY2, KEY3, VALUE>);
|
|
519
|
+
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
468
520
|
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
469
521
|
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
470
|
-
|
|
522
|
+
getOrDefault(key1: KEY1, key2: KEY2, key3: KEY3, defaultValue: VALUE): VALUE;
|
|
523
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, creator: () => VALUE): VALUE;
|
|
524
|
+
delete(key1: KEY1): boolean;
|
|
525
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
471
526
|
delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
527
|
+
clear(): void;
|
|
528
|
+
get size(): number;
|
|
529
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
530
|
+
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
531
|
+
keysArray(): [KEY1, KEY2, KEY3][];
|
|
532
|
+
values(): IterableIterator<VALUE>;
|
|
533
|
+
valuesArray(): VALUE[];
|
|
534
|
+
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
535
|
+
entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
|
|
536
|
+
[Symbol.iterator](): Generator<[KEY1, KEY2, KEY3, VALUE], void, any>;
|
|
537
|
+
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
538
|
+
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
539
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
540
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
541
|
+
filter(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
542
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
543
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
544
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): Map3<KEY1, KEY2, KEY3, R>;
|
|
545
|
+
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
546
|
+
toString(): string;
|
|
472
547
|
}
|
|
473
548
|
|
|
474
549
|
export { Assert, Cookies, Device, LRUCache, Map1, Map2, Map3, SmallIntCache, Stack, index as Utils, Vec2 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TsUtilsLib v1.
|
|
1
|
+
/* TsUtilsLib v1.13.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1293,9 +1293,13 @@ var SmallIntCache = class {
|
|
|
1293
1293
|
};
|
|
1294
1294
|
|
|
1295
1295
|
// src/core/map.ts
|
|
1296
|
-
var Map1 = class {
|
|
1297
|
-
constructor() {
|
|
1298
|
-
__publicField(this, "map1"
|
|
1296
|
+
var Map1 = class _Map1 {
|
|
1297
|
+
constructor(entries) {
|
|
1298
|
+
__publicField(this, "map1");
|
|
1299
|
+
this.map1 = entries instanceof _Map1 ? new Map(entries.map1) : new Map(entries);
|
|
1300
|
+
}
|
|
1301
|
+
has(key1) {
|
|
1302
|
+
return this.map1.has(key1);
|
|
1299
1303
|
}
|
|
1300
1304
|
set(key1, value) {
|
|
1301
1305
|
this.map1.set(key1, value);
|
|
@@ -1304,95 +1308,482 @@ var Map1 = class {
|
|
|
1304
1308
|
get(key1) {
|
|
1305
1309
|
return this.map1.get(key1);
|
|
1306
1310
|
}
|
|
1307
|
-
|
|
1308
|
-
return this.
|
|
1311
|
+
getOrDefault(key1, defaultValue) {
|
|
1312
|
+
return this.get(key1) ?? defaultValue;
|
|
1313
|
+
}
|
|
1314
|
+
getOrCreate(key1, creator) {
|
|
1315
|
+
let value = this.get(key1);
|
|
1316
|
+
if (!value) {
|
|
1317
|
+
this.set(key1, value = creator());
|
|
1318
|
+
}
|
|
1319
|
+
return value;
|
|
1309
1320
|
}
|
|
1310
1321
|
delete(key1) {
|
|
1311
1322
|
return this.map1.delete(key1);
|
|
1312
1323
|
}
|
|
1324
|
+
clear() {
|
|
1325
|
+
this.map1.clear();
|
|
1326
|
+
}
|
|
1327
|
+
get size() {
|
|
1328
|
+
return this.map1.size;
|
|
1329
|
+
}
|
|
1330
|
+
forEach(callbackfn, thisArg) {
|
|
1331
|
+
this.map1.forEach((value, key1) => callbackfn.call(thisArg, value, key1, this));
|
|
1332
|
+
}
|
|
1333
|
+
keys() {
|
|
1334
|
+
return this.map1.keys();
|
|
1335
|
+
}
|
|
1336
|
+
keysArray() {
|
|
1337
|
+
return [...this.keys()];
|
|
1338
|
+
}
|
|
1339
|
+
values() {
|
|
1340
|
+
return this.map1.values();
|
|
1341
|
+
}
|
|
1342
|
+
valuesArray() {
|
|
1343
|
+
return [...this.values()];
|
|
1344
|
+
}
|
|
1345
|
+
*entries() {
|
|
1346
|
+
for (const [key1, value] of this.map1)
|
|
1347
|
+
yield [key1, value];
|
|
1348
|
+
}
|
|
1349
|
+
entriesArray() {
|
|
1350
|
+
return [...this.entries()];
|
|
1351
|
+
}
|
|
1352
|
+
*[Symbol.iterator]() {
|
|
1353
|
+
yield* this.entries();
|
|
1354
|
+
}
|
|
1355
|
+
clone() {
|
|
1356
|
+
return new _Map1(this);
|
|
1357
|
+
}
|
|
1358
|
+
merge(other, conflictResolver) {
|
|
1359
|
+
for (const [key1, value] of other.entries()) {
|
|
1360
|
+
if (this.has(key1) && conflictResolver) {
|
|
1361
|
+
this.set(key1, conflictResolver(this.get(key1), value, key1));
|
|
1362
|
+
} else {
|
|
1363
|
+
this.set(key1, value);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return this;
|
|
1367
|
+
}
|
|
1368
|
+
some(fn) {
|
|
1369
|
+
for (const [key1, value] of this.map1) {
|
|
1370
|
+
if (fn(value, key1)) return true;
|
|
1371
|
+
}
|
|
1372
|
+
return false;
|
|
1373
|
+
}
|
|
1374
|
+
every(fn) {
|
|
1375
|
+
for (const [key1, value] of this.map1) {
|
|
1376
|
+
if (!fn(value, key1)) return false;
|
|
1377
|
+
}
|
|
1378
|
+
return true;
|
|
1379
|
+
}
|
|
1380
|
+
filter(fn) {
|
|
1381
|
+
let result = new _Map1();
|
|
1382
|
+
for (const [key1, value] of this.map1) {
|
|
1383
|
+
if (fn(value, key1)) result.set(key1, value);
|
|
1384
|
+
}
|
|
1385
|
+
return result;
|
|
1386
|
+
}
|
|
1387
|
+
reduce(fn, init) {
|
|
1388
|
+
let acc = init;
|
|
1389
|
+
for (const [key1, value] of this.map1) {
|
|
1390
|
+
acc = fn(acc, value, key1);
|
|
1391
|
+
}
|
|
1392
|
+
return acc;
|
|
1393
|
+
}
|
|
1394
|
+
mapEntries(fn) {
|
|
1395
|
+
let result = [];
|
|
1396
|
+
for (const [key1, value] of this.map1) {
|
|
1397
|
+
result.push(fn(value, key1));
|
|
1398
|
+
}
|
|
1399
|
+
return result;
|
|
1400
|
+
}
|
|
1401
|
+
mapValues(fn) {
|
|
1402
|
+
let result = new _Map1();
|
|
1403
|
+
for (const [key1, value] of this.map1) {
|
|
1404
|
+
result.set(key1, fn(value, key1));
|
|
1405
|
+
}
|
|
1406
|
+
return result;
|
|
1407
|
+
}
|
|
1408
|
+
toMap() {
|
|
1409
|
+
return new Map(this.map1);
|
|
1410
|
+
}
|
|
1411
|
+
toString() {
|
|
1412
|
+
const entries = [...this.map1].map(([k, v]) => `${k} => ${v}`).join(", ");
|
|
1413
|
+
return `Map1(${this.map1.size}) { ${entries} }`;
|
|
1414
|
+
}
|
|
1313
1415
|
};
|
|
1314
|
-
var Map2 = class {
|
|
1315
|
-
constructor() {
|
|
1416
|
+
var Map2 = class _Map2 {
|
|
1417
|
+
constructor(entries) {
|
|
1316
1418
|
__publicField(this, "map1", /* @__PURE__ */ new Map());
|
|
1419
|
+
if (entries instanceof _Map2) {
|
|
1420
|
+
for (const [key1, inner] of entries.map1) {
|
|
1421
|
+
this.map1.set(key1, new Map(inner));
|
|
1422
|
+
}
|
|
1423
|
+
} else if (entries) {
|
|
1424
|
+
for (const [key1, key2, value] of entries) {
|
|
1425
|
+
this.set(key1, key2, value);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
has(key1, key2) {
|
|
1430
|
+
return this.map1.get(key1)?.has(key2) ?? false;
|
|
1317
1431
|
}
|
|
1318
1432
|
set(key1, key2, value) {
|
|
1319
|
-
let map2 = this.map1.get(key1);
|
|
1320
|
-
if (!map2) {
|
|
1321
|
-
this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1322
|
-
}
|
|
1433
|
+
let map2 = this.map1.get(key1) ?? this.map1.set(key1, /* @__PURE__ */ new Map()).get(key1);
|
|
1323
1434
|
map2.set(key2, value);
|
|
1324
1435
|
return value;
|
|
1325
1436
|
}
|
|
1326
1437
|
get(key1, key2) {
|
|
1327
|
-
|
|
1328
|
-
if (!map2) {
|
|
1329
|
-
return void 0;
|
|
1330
|
-
}
|
|
1331
|
-
return map2.get(key2);
|
|
1438
|
+
return this.map1.get(key1)?.get(key2);
|
|
1332
1439
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1440
|
+
getOrDefault(key1, key2, defaultValue) {
|
|
1441
|
+
return this.get(key1, key2) ?? defaultValue;
|
|
1442
|
+
}
|
|
1443
|
+
getOrCreate(key1, key2, creator) {
|
|
1444
|
+
let value = this.get(key1, key2);
|
|
1445
|
+
if (!value) {
|
|
1446
|
+
this.set(key1, key2, value = creator());
|
|
1337
1447
|
}
|
|
1338
|
-
return
|
|
1448
|
+
return value;
|
|
1339
1449
|
}
|
|
1340
1450
|
delete(key1, key2) {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1451
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1452
|
+
const map2 = this.map1.get(key1);
|
|
1453
|
+
if (!map2) return false;
|
|
1345
1454
|
return map2.delete(key2);
|
|
1346
1455
|
}
|
|
1456
|
+
clear() {
|
|
1457
|
+
this.map1.clear();
|
|
1458
|
+
}
|
|
1459
|
+
get size() {
|
|
1460
|
+
let count = 0;
|
|
1461
|
+
for (const map2 of this.map1.values()) {
|
|
1462
|
+
count += map2.size;
|
|
1463
|
+
}
|
|
1464
|
+
return count;
|
|
1465
|
+
}
|
|
1466
|
+
forEach(callbackfn, thisArg) {
|
|
1467
|
+
this.map1.forEach((map2, key1) => map2.forEach((value, key2) => callbackfn.call(thisArg, value, key1, key2, this)));
|
|
1468
|
+
}
|
|
1469
|
+
keys() {
|
|
1470
|
+
function* gen(map1) {
|
|
1471
|
+
for (const [key1, map2] of map1)
|
|
1472
|
+
for (const key2 of map2.keys())
|
|
1473
|
+
yield [key1, key2];
|
|
1474
|
+
}
|
|
1475
|
+
return gen(this.map1);
|
|
1476
|
+
}
|
|
1477
|
+
keysArray() {
|
|
1478
|
+
return [...this.keys()];
|
|
1479
|
+
}
|
|
1480
|
+
values() {
|
|
1481
|
+
function* gen(map1) {
|
|
1482
|
+
for (const map2 of map1.values())
|
|
1483
|
+
for (const value of map2.values())
|
|
1484
|
+
yield value;
|
|
1485
|
+
}
|
|
1486
|
+
return gen(this.map1);
|
|
1487
|
+
}
|
|
1488
|
+
valuesArray() {
|
|
1489
|
+
return [...this.values()];
|
|
1490
|
+
}
|
|
1491
|
+
*entries() {
|
|
1492
|
+
for (const [key1, map2] of this.map1)
|
|
1493
|
+
for (const [key2, value] of map2)
|
|
1494
|
+
yield [key1, key2, value];
|
|
1495
|
+
}
|
|
1496
|
+
entriesArray() {
|
|
1497
|
+
return [...this.entries()];
|
|
1498
|
+
}
|
|
1499
|
+
*[Symbol.iterator]() {
|
|
1500
|
+
yield* this.entries();
|
|
1501
|
+
}
|
|
1502
|
+
clone() {
|
|
1503
|
+
return new _Map2(this);
|
|
1504
|
+
}
|
|
1505
|
+
merge(other, conflictResolver) {
|
|
1506
|
+
for (const [key1, key2, value] of other.entries()) {
|
|
1507
|
+
if (this.has(key1, key2) && conflictResolver) {
|
|
1508
|
+
this.set(key1, key2, conflictResolver(this.get(key1, key2), value, key1, key2));
|
|
1509
|
+
} else {
|
|
1510
|
+
this.set(key1, key2, value);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return this;
|
|
1514
|
+
}
|
|
1515
|
+
some(fn) {
|
|
1516
|
+
for (const [key1, map2] of this.map1) {
|
|
1517
|
+
for (const [key2, value] of map2) {
|
|
1518
|
+
if (fn(value, key1, key2)) return true;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
return false;
|
|
1522
|
+
}
|
|
1523
|
+
every(fn) {
|
|
1524
|
+
for (const [key1, map2] of this.map1) {
|
|
1525
|
+
for (const [key2, value] of map2) {
|
|
1526
|
+
if (!fn(value, key1, key2)) return false;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1531
|
+
filter(fn) {
|
|
1532
|
+
let result = new _Map2();
|
|
1533
|
+
for (const [key1, map2] of this.map1) {
|
|
1534
|
+
for (const [key2, value] of map2) {
|
|
1535
|
+
if (fn(value, key1, key2)) result.set(key1, key2, value);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return result;
|
|
1539
|
+
}
|
|
1540
|
+
reduce(fn, init) {
|
|
1541
|
+
let acc = init;
|
|
1542
|
+
for (const [key1, map2] of this.map1) {
|
|
1543
|
+
for (const [key2, value] of map2) {
|
|
1544
|
+
acc = fn(acc, value, key1, key2);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
return acc;
|
|
1548
|
+
}
|
|
1549
|
+
mapEntries(fn) {
|
|
1550
|
+
let result = [];
|
|
1551
|
+
for (const [key1, map2] of this.map1) {
|
|
1552
|
+
for (const [key2, value] of map2) {
|
|
1553
|
+
result.push(fn(value, key1, key2));
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
return result;
|
|
1557
|
+
}
|
|
1558
|
+
mapValues(fn) {
|
|
1559
|
+
let result = new _Map2();
|
|
1560
|
+
for (const [key1, map2] of this.map1) {
|
|
1561
|
+
for (const [key2, value] of map2) {
|
|
1562
|
+
result.set(key1, key2, fn(value, key1, key2));
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return result;
|
|
1566
|
+
}
|
|
1567
|
+
toMap() {
|
|
1568
|
+
let result = /* @__PURE__ */ new Map();
|
|
1569
|
+
for (const [key1, map2] of this.map1) {
|
|
1570
|
+
for (const [key2, value] of map2) {
|
|
1571
|
+
result.set([key1, key2], value);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
return result;
|
|
1575
|
+
}
|
|
1576
|
+
toString() {
|
|
1577
|
+
const entries = [];
|
|
1578
|
+
for (const [key1, map2] of this.map1) {
|
|
1579
|
+
const inner = [...map2].map(([key2, v]) => `${key2} => ${v}`).join(", ");
|
|
1580
|
+
entries.push(`${key1} => { ${inner} }`);
|
|
1581
|
+
}
|
|
1582
|
+
return `Map2(${this.size}) { ${entries.join(", ")} }`;
|
|
1583
|
+
}
|
|
1347
1584
|
};
|
|
1348
|
-
var Map3 = class {
|
|
1349
|
-
constructor() {
|
|
1585
|
+
var Map3 = class _Map3 {
|
|
1586
|
+
constructor(entries) {
|
|
1350
1587
|
__publicField(this, "map1", /* @__PURE__ */ new Map());
|
|
1588
|
+
if (entries instanceof _Map3) {
|
|
1589
|
+
for (const [key1, map2] of entries.map1) {
|
|
1590
|
+
const newMap2 = /* @__PURE__ */ new Map();
|
|
1591
|
+
for (const [key2, map3] of map2) {
|
|
1592
|
+
newMap2.set(key2, new Map(map3));
|
|
1593
|
+
}
|
|
1594
|
+
this.map1.set(key1, newMap2);
|
|
1595
|
+
}
|
|
1596
|
+
} else if (entries) {
|
|
1597
|
+
for (const [key1, key2, key3, value] of entries) {
|
|
1598
|
+
this.set(key1, key2, key3, value);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
has(key1, key2, key3) {
|
|
1603
|
+
return this.map1.get(key1)?.get(key2)?.has(key3) ?? false;
|
|
1351
1604
|
}
|
|
1352
1605
|
set(key1, key2, key3, value) {
|
|
1353
1606
|
let map2 = this.map1.get(key1);
|
|
1354
|
-
if (!map2)
|
|
1355
|
-
this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1356
|
-
}
|
|
1607
|
+
if (!map2) this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1357
1608
|
let map3 = map2.get(key2);
|
|
1358
|
-
if (!map3)
|
|
1359
|
-
map2.set(key2, map3 = /* @__PURE__ */ new Map());
|
|
1360
|
-
}
|
|
1609
|
+
if (!map3) map2.set(key2, map3 = /* @__PURE__ */ new Map());
|
|
1361
1610
|
map3.set(key3, value);
|
|
1362
1611
|
return value;
|
|
1363
1612
|
}
|
|
1364
1613
|
get(key1, key2, key3) {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1614
|
+
return this.map1.get(key1)?.get(key2)?.get(key3);
|
|
1615
|
+
}
|
|
1616
|
+
getOrDefault(key1, key2, key3, defaultValue) {
|
|
1617
|
+
return this.get(key1, key2, key3) ?? defaultValue;
|
|
1618
|
+
}
|
|
1619
|
+
getOrCreate(key1, key2, key3, creator) {
|
|
1620
|
+
let value = this.get(key1, key2, key3);
|
|
1621
|
+
if (!value) {
|
|
1622
|
+
this.set(key1, key2, key3, value = creator());
|
|
1368
1623
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1624
|
+
return value;
|
|
1625
|
+
}
|
|
1626
|
+
delete(key1, key2, key3) {
|
|
1627
|
+
if (key3 === void 0) {
|
|
1628
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1629
|
+
const map2 = this.map1.get(key1);
|
|
1630
|
+
if (!map2) return false;
|
|
1631
|
+
return map2.delete(key2);
|
|
1632
|
+
} else {
|
|
1633
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1634
|
+
const map3 = this.map1.get(key1)?.get(key2);
|
|
1635
|
+
if (!map3) return false;
|
|
1636
|
+
return map3.delete(key3);
|
|
1372
1637
|
}
|
|
1373
|
-
return map3.get(key3);
|
|
1374
1638
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1639
|
+
clear() {
|
|
1640
|
+
this.map1.clear();
|
|
1641
|
+
}
|
|
1642
|
+
get size() {
|
|
1643
|
+
let count = 0;
|
|
1644
|
+
for (const map2 of this.map1.values()) {
|
|
1645
|
+
for (const map3 of map2.values()) {
|
|
1646
|
+
count += map3.size;
|
|
1647
|
+
}
|
|
1379
1648
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1649
|
+
return count;
|
|
1650
|
+
}
|
|
1651
|
+
forEach(callbackfn, thisArg) {
|
|
1652
|
+
this.map1.forEach((map2, key1) => map2.forEach((map3, key2) => map3.forEach((value, key3) => callbackfn.call(thisArg, value, key1, key2, key3, this))));
|
|
1653
|
+
}
|
|
1654
|
+
keys() {
|
|
1655
|
+
function* gen(map1) {
|
|
1656
|
+
for (const [key1, map2] of map1)
|
|
1657
|
+
for (const [key2, map3] of map2)
|
|
1658
|
+
for (const key3 of map3.keys())
|
|
1659
|
+
yield [key1, key2, key3];
|
|
1383
1660
|
}
|
|
1384
|
-
return
|
|
1661
|
+
return gen(this.map1);
|
|
1385
1662
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1663
|
+
keysArray() {
|
|
1664
|
+
return [...this.keys()];
|
|
1665
|
+
}
|
|
1666
|
+
values() {
|
|
1667
|
+
function* gen(map1) {
|
|
1668
|
+
for (const map2 of map1.values())
|
|
1669
|
+
for (const map3 of map2.values())
|
|
1670
|
+
for (const value of map3.values())
|
|
1671
|
+
yield value;
|
|
1390
1672
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1673
|
+
return gen(this.map1);
|
|
1674
|
+
}
|
|
1675
|
+
valuesArray() {
|
|
1676
|
+
return [...this.values()];
|
|
1677
|
+
}
|
|
1678
|
+
*entries() {
|
|
1679
|
+
for (const [key1, map2] of this.map1)
|
|
1680
|
+
for (const [key2, map3] of map2)
|
|
1681
|
+
for (const [key3, value] of map3)
|
|
1682
|
+
yield [key1, key2, key3, value];
|
|
1683
|
+
}
|
|
1684
|
+
entriesArray() {
|
|
1685
|
+
return [...this.entries()];
|
|
1686
|
+
}
|
|
1687
|
+
*[Symbol.iterator]() {
|
|
1688
|
+
yield* this.entries();
|
|
1689
|
+
}
|
|
1690
|
+
clone() {
|
|
1691
|
+
return new _Map3(this);
|
|
1692
|
+
}
|
|
1693
|
+
merge(other, conflictResolver) {
|
|
1694
|
+
for (const [key1, key2, key3, value] of other.entries()) {
|
|
1695
|
+
if (this.has(key1, key2, key3) && conflictResolver) {
|
|
1696
|
+
this.set(key1, key2, key3, conflictResolver(this.get(key1, key2, key3), value, key1, key2, key3));
|
|
1697
|
+
} else {
|
|
1698
|
+
this.set(key1, key2, key3, value);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
return this;
|
|
1702
|
+
}
|
|
1703
|
+
some(fn) {
|
|
1704
|
+
for (const [key1, map2] of this.map1) {
|
|
1705
|
+
for (const [key2, map3] of map2) {
|
|
1706
|
+
for (const [key3, value] of map3) {
|
|
1707
|
+
if (fn(value, key1, key2, key3)) return true;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return false;
|
|
1712
|
+
}
|
|
1713
|
+
every(fn) {
|
|
1714
|
+
for (const [key1, map2] of this.map1) {
|
|
1715
|
+
for (const [key2, map3] of map2) {
|
|
1716
|
+
for (const [key3, value] of map3) {
|
|
1717
|
+
if (!fn(value, key1, key2, key3)) return false;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return true;
|
|
1722
|
+
}
|
|
1723
|
+
filter(fn) {
|
|
1724
|
+
let result = new _Map3();
|
|
1725
|
+
for (const [key1, map2] of this.map1) {
|
|
1726
|
+
for (const [key2, map3] of map2) {
|
|
1727
|
+
for (const [key3, value] of map3) {
|
|
1728
|
+
if (fn(value, key1, key2, key3)) result.set(key1, key2, key3, value);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
return result;
|
|
1733
|
+
}
|
|
1734
|
+
reduce(fn, init) {
|
|
1735
|
+
let acc = init;
|
|
1736
|
+
for (const [key1, map2] of this.map1) {
|
|
1737
|
+
for (const [key2, map3] of map2) {
|
|
1738
|
+
for (const [key3, value] of map3) {
|
|
1739
|
+
acc = fn(acc, value, key1, key2, key3);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
return acc;
|
|
1744
|
+
}
|
|
1745
|
+
mapEntries(fn) {
|
|
1746
|
+
let result = [];
|
|
1747
|
+
for (const [key1, map2] of this.map1) {
|
|
1748
|
+
for (const [key2, map3] of map2) {
|
|
1749
|
+
for (const [key3, value] of map3) {
|
|
1750
|
+
result.push(fn(value, key1, key2, key3));
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
return result;
|
|
1755
|
+
}
|
|
1756
|
+
mapValues(fn) {
|
|
1757
|
+
let result = new _Map3();
|
|
1758
|
+
for (const [key1, map2] of this.map1) {
|
|
1759
|
+
for (const [key2, map3] of map2) {
|
|
1760
|
+
for (const [key3, value] of map3) {
|
|
1761
|
+
result.set(key1, key2, key3, fn(value, key1, key2, key3));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return result;
|
|
1766
|
+
}
|
|
1767
|
+
toMap() {
|
|
1768
|
+
let result = /* @__PURE__ */ new Map();
|
|
1769
|
+
for (const [key1, map2] of this.map1) {
|
|
1770
|
+
for (const [key2, map3] of map2) {
|
|
1771
|
+
for (const [key3, value] of map3) {
|
|
1772
|
+
result.set([key1, key2, key3], value);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return result;
|
|
1777
|
+
}
|
|
1778
|
+
toString() {
|
|
1779
|
+
const entries = [];
|
|
1780
|
+
for (const [key1, map2] of this.map1) {
|
|
1781
|
+
for (const [key2, map3] of map2) {
|
|
1782
|
+
const inner = [...map3].map(([key3, v]) => `${key3} => ${v}`).join(", ");
|
|
1783
|
+
entries.push(`${key1} => ${key2} => { ${inner} }`);
|
|
1784
|
+
}
|
|
1394
1785
|
}
|
|
1395
|
-
return
|
|
1786
|
+
return `Map3(${this.size}) { ${entries.join(", ")} }`;
|
|
1396
1787
|
}
|
|
1397
1788
|
};
|
|
1398
1789
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TsUtilsLib v1.
|
|
1
|
+
/* TsUtilsLib v1.13.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __export = (target, all) => {
|
|
@@ -1263,9 +1263,13 @@ var SmallIntCache = class {
|
|
|
1263
1263
|
};
|
|
1264
1264
|
|
|
1265
1265
|
// src/core/map.ts
|
|
1266
|
-
var Map1 = class {
|
|
1267
|
-
constructor() {
|
|
1268
|
-
__publicField(this, "map1"
|
|
1266
|
+
var Map1 = class _Map1 {
|
|
1267
|
+
constructor(entries) {
|
|
1268
|
+
__publicField(this, "map1");
|
|
1269
|
+
this.map1 = entries instanceof _Map1 ? new Map(entries.map1) : new Map(entries);
|
|
1270
|
+
}
|
|
1271
|
+
has(key1) {
|
|
1272
|
+
return this.map1.has(key1);
|
|
1269
1273
|
}
|
|
1270
1274
|
set(key1, value) {
|
|
1271
1275
|
this.map1.set(key1, value);
|
|
@@ -1274,95 +1278,482 @@ var Map1 = class {
|
|
|
1274
1278
|
get(key1) {
|
|
1275
1279
|
return this.map1.get(key1);
|
|
1276
1280
|
}
|
|
1277
|
-
|
|
1278
|
-
return this.
|
|
1281
|
+
getOrDefault(key1, defaultValue) {
|
|
1282
|
+
return this.get(key1) ?? defaultValue;
|
|
1283
|
+
}
|
|
1284
|
+
getOrCreate(key1, creator) {
|
|
1285
|
+
let value = this.get(key1);
|
|
1286
|
+
if (!value) {
|
|
1287
|
+
this.set(key1, value = creator());
|
|
1288
|
+
}
|
|
1289
|
+
return value;
|
|
1279
1290
|
}
|
|
1280
1291
|
delete(key1) {
|
|
1281
1292
|
return this.map1.delete(key1);
|
|
1282
1293
|
}
|
|
1294
|
+
clear() {
|
|
1295
|
+
this.map1.clear();
|
|
1296
|
+
}
|
|
1297
|
+
get size() {
|
|
1298
|
+
return this.map1.size;
|
|
1299
|
+
}
|
|
1300
|
+
forEach(callbackfn, thisArg) {
|
|
1301
|
+
this.map1.forEach((value, key1) => callbackfn.call(thisArg, value, key1, this));
|
|
1302
|
+
}
|
|
1303
|
+
keys() {
|
|
1304
|
+
return this.map1.keys();
|
|
1305
|
+
}
|
|
1306
|
+
keysArray() {
|
|
1307
|
+
return [...this.keys()];
|
|
1308
|
+
}
|
|
1309
|
+
values() {
|
|
1310
|
+
return this.map1.values();
|
|
1311
|
+
}
|
|
1312
|
+
valuesArray() {
|
|
1313
|
+
return [...this.values()];
|
|
1314
|
+
}
|
|
1315
|
+
*entries() {
|
|
1316
|
+
for (const [key1, value] of this.map1)
|
|
1317
|
+
yield [key1, value];
|
|
1318
|
+
}
|
|
1319
|
+
entriesArray() {
|
|
1320
|
+
return [...this.entries()];
|
|
1321
|
+
}
|
|
1322
|
+
*[Symbol.iterator]() {
|
|
1323
|
+
yield* this.entries();
|
|
1324
|
+
}
|
|
1325
|
+
clone() {
|
|
1326
|
+
return new _Map1(this);
|
|
1327
|
+
}
|
|
1328
|
+
merge(other, conflictResolver) {
|
|
1329
|
+
for (const [key1, value] of other.entries()) {
|
|
1330
|
+
if (this.has(key1) && conflictResolver) {
|
|
1331
|
+
this.set(key1, conflictResolver(this.get(key1), value, key1));
|
|
1332
|
+
} else {
|
|
1333
|
+
this.set(key1, value);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
return this;
|
|
1337
|
+
}
|
|
1338
|
+
some(fn) {
|
|
1339
|
+
for (const [key1, value] of this.map1) {
|
|
1340
|
+
if (fn(value, key1)) return true;
|
|
1341
|
+
}
|
|
1342
|
+
return false;
|
|
1343
|
+
}
|
|
1344
|
+
every(fn) {
|
|
1345
|
+
for (const [key1, value] of this.map1) {
|
|
1346
|
+
if (!fn(value, key1)) return false;
|
|
1347
|
+
}
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
filter(fn) {
|
|
1351
|
+
let result = new _Map1();
|
|
1352
|
+
for (const [key1, value] of this.map1) {
|
|
1353
|
+
if (fn(value, key1)) result.set(key1, value);
|
|
1354
|
+
}
|
|
1355
|
+
return result;
|
|
1356
|
+
}
|
|
1357
|
+
reduce(fn, init) {
|
|
1358
|
+
let acc = init;
|
|
1359
|
+
for (const [key1, value] of this.map1) {
|
|
1360
|
+
acc = fn(acc, value, key1);
|
|
1361
|
+
}
|
|
1362
|
+
return acc;
|
|
1363
|
+
}
|
|
1364
|
+
mapEntries(fn) {
|
|
1365
|
+
let result = [];
|
|
1366
|
+
for (const [key1, value] of this.map1) {
|
|
1367
|
+
result.push(fn(value, key1));
|
|
1368
|
+
}
|
|
1369
|
+
return result;
|
|
1370
|
+
}
|
|
1371
|
+
mapValues(fn) {
|
|
1372
|
+
let result = new _Map1();
|
|
1373
|
+
for (const [key1, value] of this.map1) {
|
|
1374
|
+
result.set(key1, fn(value, key1));
|
|
1375
|
+
}
|
|
1376
|
+
return result;
|
|
1377
|
+
}
|
|
1378
|
+
toMap() {
|
|
1379
|
+
return new Map(this.map1);
|
|
1380
|
+
}
|
|
1381
|
+
toString() {
|
|
1382
|
+
const entries = [...this.map1].map(([k, v]) => `${k} => ${v}`).join(", ");
|
|
1383
|
+
return `Map1(${this.map1.size}) { ${entries} }`;
|
|
1384
|
+
}
|
|
1283
1385
|
};
|
|
1284
|
-
var Map2 = class {
|
|
1285
|
-
constructor() {
|
|
1386
|
+
var Map2 = class _Map2 {
|
|
1387
|
+
constructor(entries) {
|
|
1286
1388
|
__publicField(this, "map1", /* @__PURE__ */ new Map());
|
|
1389
|
+
if (entries instanceof _Map2) {
|
|
1390
|
+
for (const [key1, inner] of entries.map1) {
|
|
1391
|
+
this.map1.set(key1, new Map(inner));
|
|
1392
|
+
}
|
|
1393
|
+
} else if (entries) {
|
|
1394
|
+
for (const [key1, key2, value] of entries) {
|
|
1395
|
+
this.set(key1, key2, value);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
has(key1, key2) {
|
|
1400
|
+
return this.map1.get(key1)?.has(key2) ?? false;
|
|
1287
1401
|
}
|
|
1288
1402
|
set(key1, key2, value) {
|
|
1289
|
-
let map2 = this.map1.get(key1);
|
|
1290
|
-
if (!map2) {
|
|
1291
|
-
this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1292
|
-
}
|
|
1403
|
+
let map2 = this.map1.get(key1) ?? this.map1.set(key1, /* @__PURE__ */ new Map()).get(key1);
|
|
1293
1404
|
map2.set(key2, value);
|
|
1294
1405
|
return value;
|
|
1295
1406
|
}
|
|
1296
1407
|
get(key1, key2) {
|
|
1297
|
-
|
|
1298
|
-
if (!map2) {
|
|
1299
|
-
return void 0;
|
|
1300
|
-
}
|
|
1301
|
-
return map2.get(key2);
|
|
1408
|
+
return this.map1.get(key1)?.get(key2);
|
|
1302
1409
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1410
|
+
getOrDefault(key1, key2, defaultValue) {
|
|
1411
|
+
return this.get(key1, key2) ?? defaultValue;
|
|
1412
|
+
}
|
|
1413
|
+
getOrCreate(key1, key2, creator) {
|
|
1414
|
+
let value = this.get(key1, key2);
|
|
1415
|
+
if (!value) {
|
|
1416
|
+
this.set(key1, key2, value = creator());
|
|
1307
1417
|
}
|
|
1308
|
-
return
|
|
1418
|
+
return value;
|
|
1309
1419
|
}
|
|
1310
1420
|
delete(key1, key2) {
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1421
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1422
|
+
const map2 = this.map1.get(key1);
|
|
1423
|
+
if (!map2) return false;
|
|
1315
1424
|
return map2.delete(key2);
|
|
1316
1425
|
}
|
|
1426
|
+
clear() {
|
|
1427
|
+
this.map1.clear();
|
|
1428
|
+
}
|
|
1429
|
+
get size() {
|
|
1430
|
+
let count = 0;
|
|
1431
|
+
for (const map2 of this.map1.values()) {
|
|
1432
|
+
count += map2.size;
|
|
1433
|
+
}
|
|
1434
|
+
return count;
|
|
1435
|
+
}
|
|
1436
|
+
forEach(callbackfn, thisArg) {
|
|
1437
|
+
this.map1.forEach((map2, key1) => map2.forEach((value, key2) => callbackfn.call(thisArg, value, key1, key2, this)));
|
|
1438
|
+
}
|
|
1439
|
+
keys() {
|
|
1440
|
+
function* gen(map1) {
|
|
1441
|
+
for (const [key1, map2] of map1)
|
|
1442
|
+
for (const key2 of map2.keys())
|
|
1443
|
+
yield [key1, key2];
|
|
1444
|
+
}
|
|
1445
|
+
return gen(this.map1);
|
|
1446
|
+
}
|
|
1447
|
+
keysArray() {
|
|
1448
|
+
return [...this.keys()];
|
|
1449
|
+
}
|
|
1450
|
+
values() {
|
|
1451
|
+
function* gen(map1) {
|
|
1452
|
+
for (const map2 of map1.values())
|
|
1453
|
+
for (const value of map2.values())
|
|
1454
|
+
yield value;
|
|
1455
|
+
}
|
|
1456
|
+
return gen(this.map1);
|
|
1457
|
+
}
|
|
1458
|
+
valuesArray() {
|
|
1459
|
+
return [...this.values()];
|
|
1460
|
+
}
|
|
1461
|
+
*entries() {
|
|
1462
|
+
for (const [key1, map2] of this.map1)
|
|
1463
|
+
for (const [key2, value] of map2)
|
|
1464
|
+
yield [key1, key2, value];
|
|
1465
|
+
}
|
|
1466
|
+
entriesArray() {
|
|
1467
|
+
return [...this.entries()];
|
|
1468
|
+
}
|
|
1469
|
+
*[Symbol.iterator]() {
|
|
1470
|
+
yield* this.entries();
|
|
1471
|
+
}
|
|
1472
|
+
clone() {
|
|
1473
|
+
return new _Map2(this);
|
|
1474
|
+
}
|
|
1475
|
+
merge(other, conflictResolver) {
|
|
1476
|
+
for (const [key1, key2, value] of other.entries()) {
|
|
1477
|
+
if (this.has(key1, key2) && conflictResolver) {
|
|
1478
|
+
this.set(key1, key2, conflictResolver(this.get(key1, key2), value, key1, key2));
|
|
1479
|
+
} else {
|
|
1480
|
+
this.set(key1, key2, value);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return this;
|
|
1484
|
+
}
|
|
1485
|
+
some(fn) {
|
|
1486
|
+
for (const [key1, map2] of this.map1) {
|
|
1487
|
+
for (const [key2, value] of map2) {
|
|
1488
|
+
if (fn(value, key1, key2)) return true;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
return false;
|
|
1492
|
+
}
|
|
1493
|
+
every(fn) {
|
|
1494
|
+
for (const [key1, map2] of this.map1) {
|
|
1495
|
+
for (const [key2, value] of map2) {
|
|
1496
|
+
if (!fn(value, key1, key2)) return false;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
return true;
|
|
1500
|
+
}
|
|
1501
|
+
filter(fn) {
|
|
1502
|
+
let result = new _Map2();
|
|
1503
|
+
for (const [key1, map2] of this.map1) {
|
|
1504
|
+
for (const [key2, value] of map2) {
|
|
1505
|
+
if (fn(value, key1, key2)) result.set(key1, key2, value);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return result;
|
|
1509
|
+
}
|
|
1510
|
+
reduce(fn, init) {
|
|
1511
|
+
let acc = init;
|
|
1512
|
+
for (const [key1, map2] of this.map1) {
|
|
1513
|
+
for (const [key2, value] of map2) {
|
|
1514
|
+
acc = fn(acc, value, key1, key2);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
return acc;
|
|
1518
|
+
}
|
|
1519
|
+
mapEntries(fn) {
|
|
1520
|
+
let result = [];
|
|
1521
|
+
for (const [key1, map2] of this.map1) {
|
|
1522
|
+
for (const [key2, value] of map2) {
|
|
1523
|
+
result.push(fn(value, key1, key2));
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return result;
|
|
1527
|
+
}
|
|
1528
|
+
mapValues(fn) {
|
|
1529
|
+
let result = new _Map2();
|
|
1530
|
+
for (const [key1, map2] of this.map1) {
|
|
1531
|
+
for (const [key2, value] of map2) {
|
|
1532
|
+
result.set(key1, key2, fn(value, key1, key2));
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
return result;
|
|
1536
|
+
}
|
|
1537
|
+
toMap() {
|
|
1538
|
+
let result = /* @__PURE__ */ new Map();
|
|
1539
|
+
for (const [key1, map2] of this.map1) {
|
|
1540
|
+
for (const [key2, value] of map2) {
|
|
1541
|
+
result.set([key1, key2], value);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
return result;
|
|
1545
|
+
}
|
|
1546
|
+
toString() {
|
|
1547
|
+
const entries = [];
|
|
1548
|
+
for (const [key1, map2] of this.map1) {
|
|
1549
|
+
const inner = [...map2].map(([key2, v]) => `${key2} => ${v}`).join(", ");
|
|
1550
|
+
entries.push(`${key1} => { ${inner} }`);
|
|
1551
|
+
}
|
|
1552
|
+
return `Map2(${this.size}) { ${entries.join(", ")} }`;
|
|
1553
|
+
}
|
|
1317
1554
|
};
|
|
1318
|
-
var Map3 = class {
|
|
1319
|
-
constructor() {
|
|
1555
|
+
var Map3 = class _Map3 {
|
|
1556
|
+
constructor(entries) {
|
|
1320
1557
|
__publicField(this, "map1", /* @__PURE__ */ new Map());
|
|
1558
|
+
if (entries instanceof _Map3) {
|
|
1559
|
+
for (const [key1, map2] of entries.map1) {
|
|
1560
|
+
const newMap2 = /* @__PURE__ */ new Map();
|
|
1561
|
+
for (const [key2, map3] of map2) {
|
|
1562
|
+
newMap2.set(key2, new Map(map3));
|
|
1563
|
+
}
|
|
1564
|
+
this.map1.set(key1, newMap2);
|
|
1565
|
+
}
|
|
1566
|
+
} else if (entries) {
|
|
1567
|
+
for (const [key1, key2, key3, value] of entries) {
|
|
1568
|
+
this.set(key1, key2, key3, value);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
has(key1, key2, key3) {
|
|
1573
|
+
return this.map1.get(key1)?.get(key2)?.has(key3) ?? false;
|
|
1321
1574
|
}
|
|
1322
1575
|
set(key1, key2, key3, value) {
|
|
1323
1576
|
let map2 = this.map1.get(key1);
|
|
1324
|
-
if (!map2)
|
|
1325
|
-
this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1326
|
-
}
|
|
1577
|
+
if (!map2) this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
|
|
1327
1578
|
let map3 = map2.get(key2);
|
|
1328
|
-
if (!map3)
|
|
1329
|
-
map2.set(key2, map3 = /* @__PURE__ */ new Map());
|
|
1330
|
-
}
|
|
1579
|
+
if (!map3) map2.set(key2, map3 = /* @__PURE__ */ new Map());
|
|
1331
1580
|
map3.set(key3, value);
|
|
1332
1581
|
return value;
|
|
1333
1582
|
}
|
|
1334
1583
|
get(key1, key2, key3) {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1584
|
+
return this.map1.get(key1)?.get(key2)?.get(key3);
|
|
1585
|
+
}
|
|
1586
|
+
getOrDefault(key1, key2, key3, defaultValue) {
|
|
1587
|
+
return this.get(key1, key2, key3) ?? defaultValue;
|
|
1588
|
+
}
|
|
1589
|
+
getOrCreate(key1, key2, key3, creator) {
|
|
1590
|
+
let value = this.get(key1, key2, key3);
|
|
1591
|
+
if (!value) {
|
|
1592
|
+
this.set(key1, key2, key3, value = creator());
|
|
1338
1593
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1594
|
+
return value;
|
|
1595
|
+
}
|
|
1596
|
+
delete(key1, key2, key3) {
|
|
1597
|
+
if (key3 === void 0) {
|
|
1598
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1599
|
+
const map2 = this.map1.get(key1);
|
|
1600
|
+
if (!map2) return false;
|
|
1601
|
+
return map2.delete(key2);
|
|
1602
|
+
} else {
|
|
1603
|
+
if (key2 === void 0) return this.map1.delete(key1);
|
|
1604
|
+
const map3 = this.map1.get(key1)?.get(key2);
|
|
1605
|
+
if (!map3) return false;
|
|
1606
|
+
return map3.delete(key3);
|
|
1342
1607
|
}
|
|
1343
|
-
return map3.get(key3);
|
|
1344
1608
|
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1609
|
+
clear() {
|
|
1610
|
+
this.map1.clear();
|
|
1611
|
+
}
|
|
1612
|
+
get size() {
|
|
1613
|
+
let count = 0;
|
|
1614
|
+
for (const map2 of this.map1.values()) {
|
|
1615
|
+
for (const map3 of map2.values()) {
|
|
1616
|
+
count += map3.size;
|
|
1617
|
+
}
|
|
1349
1618
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1619
|
+
return count;
|
|
1620
|
+
}
|
|
1621
|
+
forEach(callbackfn, thisArg) {
|
|
1622
|
+
this.map1.forEach((map2, key1) => map2.forEach((map3, key2) => map3.forEach((value, key3) => callbackfn.call(thisArg, value, key1, key2, key3, this))));
|
|
1623
|
+
}
|
|
1624
|
+
keys() {
|
|
1625
|
+
function* gen(map1) {
|
|
1626
|
+
for (const [key1, map2] of map1)
|
|
1627
|
+
for (const [key2, map3] of map2)
|
|
1628
|
+
for (const key3 of map3.keys())
|
|
1629
|
+
yield [key1, key2, key3];
|
|
1353
1630
|
}
|
|
1354
|
-
return
|
|
1631
|
+
return gen(this.map1);
|
|
1355
1632
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1633
|
+
keysArray() {
|
|
1634
|
+
return [...this.keys()];
|
|
1635
|
+
}
|
|
1636
|
+
values() {
|
|
1637
|
+
function* gen(map1) {
|
|
1638
|
+
for (const map2 of map1.values())
|
|
1639
|
+
for (const map3 of map2.values())
|
|
1640
|
+
for (const value of map3.values())
|
|
1641
|
+
yield value;
|
|
1360
1642
|
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1643
|
+
return gen(this.map1);
|
|
1644
|
+
}
|
|
1645
|
+
valuesArray() {
|
|
1646
|
+
return [...this.values()];
|
|
1647
|
+
}
|
|
1648
|
+
*entries() {
|
|
1649
|
+
for (const [key1, map2] of this.map1)
|
|
1650
|
+
for (const [key2, map3] of map2)
|
|
1651
|
+
for (const [key3, value] of map3)
|
|
1652
|
+
yield [key1, key2, key3, value];
|
|
1653
|
+
}
|
|
1654
|
+
entriesArray() {
|
|
1655
|
+
return [...this.entries()];
|
|
1656
|
+
}
|
|
1657
|
+
*[Symbol.iterator]() {
|
|
1658
|
+
yield* this.entries();
|
|
1659
|
+
}
|
|
1660
|
+
clone() {
|
|
1661
|
+
return new _Map3(this);
|
|
1662
|
+
}
|
|
1663
|
+
merge(other, conflictResolver) {
|
|
1664
|
+
for (const [key1, key2, key3, value] of other.entries()) {
|
|
1665
|
+
if (this.has(key1, key2, key3) && conflictResolver) {
|
|
1666
|
+
this.set(key1, key2, key3, conflictResolver(this.get(key1, key2, key3), value, key1, key2, key3));
|
|
1667
|
+
} else {
|
|
1668
|
+
this.set(key1, key2, key3, value);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return this;
|
|
1672
|
+
}
|
|
1673
|
+
some(fn) {
|
|
1674
|
+
for (const [key1, map2] of this.map1) {
|
|
1675
|
+
for (const [key2, map3] of map2) {
|
|
1676
|
+
for (const [key3, value] of map3) {
|
|
1677
|
+
if (fn(value, key1, key2, key3)) return true;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
return false;
|
|
1682
|
+
}
|
|
1683
|
+
every(fn) {
|
|
1684
|
+
for (const [key1, map2] of this.map1) {
|
|
1685
|
+
for (const [key2, map3] of map2) {
|
|
1686
|
+
for (const [key3, value] of map3) {
|
|
1687
|
+
if (!fn(value, key1, key2, key3)) return false;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
return true;
|
|
1692
|
+
}
|
|
1693
|
+
filter(fn) {
|
|
1694
|
+
let result = new _Map3();
|
|
1695
|
+
for (const [key1, map2] of this.map1) {
|
|
1696
|
+
for (const [key2, map3] of map2) {
|
|
1697
|
+
for (const [key3, value] of map3) {
|
|
1698
|
+
if (fn(value, key1, key2, key3)) result.set(key1, key2, key3, value);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
return result;
|
|
1703
|
+
}
|
|
1704
|
+
reduce(fn, init) {
|
|
1705
|
+
let acc = init;
|
|
1706
|
+
for (const [key1, map2] of this.map1) {
|
|
1707
|
+
for (const [key2, map3] of map2) {
|
|
1708
|
+
for (const [key3, value] of map3) {
|
|
1709
|
+
acc = fn(acc, value, key1, key2, key3);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
return acc;
|
|
1714
|
+
}
|
|
1715
|
+
mapEntries(fn) {
|
|
1716
|
+
let result = [];
|
|
1717
|
+
for (const [key1, map2] of this.map1) {
|
|
1718
|
+
for (const [key2, map3] of map2) {
|
|
1719
|
+
for (const [key3, value] of map3) {
|
|
1720
|
+
result.push(fn(value, key1, key2, key3));
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
return result;
|
|
1725
|
+
}
|
|
1726
|
+
mapValues(fn) {
|
|
1727
|
+
let result = new _Map3();
|
|
1728
|
+
for (const [key1, map2] of this.map1) {
|
|
1729
|
+
for (const [key2, map3] of map2) {
|
|
1730
|
+
for (const [key3, value] of map3) {
|
|
1731
|
+
result.set(key1, key2, key3, fn(value, key1, key2, key3));
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
return result;
|
|
1736
|
+
}
|
|
1737
|
+
toMap() {
|
|
1738
|
+
let result = /* @__PURE__ */ new Map();
|
|
1739
|
+
for (const [key1, map2] of this.map1) {
|
|
1740
|
+
for (const [key2, map3] of map2) {
|
|
1741
|
+
for (const [key3, value] of map3) {
|
|
1742
|
+
result.set([key1, key2, key3], value);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
return result;
|
|
1747
|
+
}
|
|
1748
|
+
toString() {
|
|
1749
|
+
const entries = [];
|
|
1750
|
+
for (const [key1, map2] of this.map1) {
|
|
1751
|
+
for (const [key2, map3] of map2) {
|
|
1752
|
+
const inner = [...map3].map(([key3, v]) => `${key3} => ${v}`).join(", ");
|
|
1753
|
+
entries.push(`${key1} => ${key2} => { ${inner} }`);
|
|
1754
|
+
}
|
|
1364
1755
|
}
|
|
1365
|
-
return
|
|
1756
|
+
return `Map3(${this.size}) { ${entries.join(", ")} }`;
|
|
1366
1757
|
}
|
|
1367
1758
|
};
|
|
1368
1759
|
export {
|