@tspro/ts-utils-lib 1.10.0 → 1.12.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.12.0] - 2025-10-15
4
+ ### Added
5
+ - Added more functionality to Map1, Map2 and Map3.
6
+
7
+ ## [1.11.0] - 2025-10-15
8
+ ### Added
9
+ - Forgot to build 1.10.0, now added Map1, Map2 and Map3.
10
+
3
11
  ## [1.10.0] - 2025-10-15
4
12
  ### Added
5
13
  - Map1<KEY1, VALUE>
package/dist/index.d.mts CHANGED
@@ -446,4 +446,53 @@ declare class SmallIntCache<V> {
446
446
  clear(): void;
447
447
  }
448
448
 
449
- export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack, index as Utils, Vec2 };
449
+ declare class Map1<KEY1, VALUE> {
450
+ private map1;
451
+ constructor();
452
+ set(key1: KEY1, value: VALUE): VALUE;
453
+ get(key1: KEY1): VALUE | undefined;
454
+ has(key1: KEY1): boolean;
455
+ delete(key1: KEY1): boolean;
456
+ clear(): void;
457
+ get size(): number;
458
+ forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
459
+ keys(): IterableIterator<KEY1>;
460
+ values(): IterableIterator<VALUE>;
461
+ entries(): IterableIterator<[KEY1, VALUE]>;
462
+ [Symbol.iterator](): Generator<[KEY1, VALUE], void, any>;
463
+ }
464
+ declare class Map2<KEY1, KEY2, VALUE> {
465
+ private map1;
466
+ constructor();
467
+ set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
468
+ get(key1: KEY1, key2: KEY2): VALUE | undefined;
469
+ has(key1: KEY1, key2: KEY2): boolean;
470
+ delete(key1: KEY1): boolean;
471
+ delete(key1: KEY1, key2: KEY2): boolean;
472
+ clear(): void;
473
+ get size(): number;
474
+ forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
475
+ keys(): IterableIterator<[KEY1, KEY2]>;
476
+ values(): IterableIterator<VALUE>;
477
+ entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
478
+ [Symbol.iterator](): Generator<[KEY1, KEY2, VALUE], void, any>;
479
+ }
480
+ declare class Map3<KEY1, KEY2, KEY3, VALUE> {
481
+ private map1;
482
+ constructor();
483
+ set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
484
+ get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
485
+ has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
486
+ delete(key1: KEY1): boolean;
487
+ delete(key1: KEY1, key2: KEY2): boolean;
488
+ delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
489
+ clear(): void;
490
+ get size(): number;
491
+ forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
492
+ keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
493
+ values(): IterableIterator<VALUE>;
494
+ entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
495
+ [Symbol.iterator](): Generator<[KEY1, KEY2, KEY3, VALUE], void, any>;
496
+ }
497
+
498
+ export { Assert, Cookies, Device, LRUCache, Map1, Map2, Map3, SmallIntCache, Stack, index as Utils, Vec2 };
package/dist/index.d.ts CHANGED
@@ -446,4 +446,53 @@ declare class SmallIntCache<V> {
446
446
  clear(): void;
447
447
  }
448
448
 
449
- export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack, index as Utils, Vec2 };
449
+ declare class Map1<KEY1, VALUE> {
450
+ private map1;
451
+ constructor();
452
+ set(key1: KEY1, value: VALUE): VALUE;
453
+ get(key1: KEY1): VALUE | undefined;
454
+ has(key1: KEY1): boolean;
455
+ delete(key1: KEY1): boolean;
456
+ clear(): void;
457
+ get size(): number;
458
+ forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
459
+ keys(): IterableIterator<KEY1>;
460
+ values(): IterableIterator<VALUE>;
461
+ entries(): IterableIterator<[KEY1, VALUE]>;
462
+ [Symbol.iterator](): Generator<[KEY1, VALUE], void, any>;
463
+ }
464
+ declare class Map2<KEY1, KEY2, VALUE> {
465
+ private map1;
466
+ constructor();
467
+ set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
468
+ get(key1: KEY1, key2: KEY2): VALUE | undefined;
469
+ has(key1: KEY1, key2: KEY2): boolean;
470
+ delete(key1: KEY1): boolean;
471
+ delete(key1: KEY1, key2: KEY2): boolean;
472
+ clear(): void;
473
+ get size(): number;
474
+ forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
475
+ keys(): IterableIterator<[KEY1, KEY2]>;
476
+ values(): IterableIterator<VALUE>;
477
+ entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
478
+ [Symbol.iterator](): Generator<[KEY1, KEY2, VALUE], void, any>;
479
+ }
480
+ declare class Map3<KEY1, KEY2, KEY3, VALUE> {
481
+ private map1;
482
+ constructor();
483
+ set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
484
+ get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
485
+ has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
486
+ delete(key1: KEY1): boolean;
487
+ delete(key1: KEY1, key2: KEY2): boolean;
488
+ delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
489
+ clear(): void;
490
+ get size(): number;
491
+ forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
492
+ keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
493
+ values(): IterableIterator<VALUE>;
494
+ entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
495
+ [Symbol.iterator](): Generator<[KEY1, KEY2, KEY3, VALUE], void, any>;
496
+ }
497
+
498
+ 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.9.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.12.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;
@@ -27,6 +27,9 @@ __export(index_exports, {
27
27
  Cookies: () => Cookies,
28
28
  Device: () => Device,
29
29
  LRUCache: () => LRUCache,
30
+ Map1: () => Map1,
31
+ Map2: () => Map2,
32
+ Map3: () => Map3,
30
33
  SmallIntCache: () => SmallIntCache,
31
34
  Stack: () => Stack,
32
35
  Utils: () => utils_exports,
@@ -1288,12 +1291,190 @@ var SmallIntCache = class {
1288
1291
  this.neg = [];
1289
1292
  }
1290
1293
  };
1294
+
1295
+ // src/core/map.ts
1296
+ var Map1 = class {
1297
+ constructor() {
1298
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1299
+ }
1300
+ set(key1, value) {
1301
+ this.map1.set(key1, value);
1302
+ return value;
1303
+ }
1304
+ get(key1) {
1305
+ return this.map1.get(key1);
1306
+ }
1307
+ has(key1) {
1308
+ return this.map1.has(key1);
1309
+ }
1310
+ delete(key1) {
1311
+ return this.map1.delete(key1);
1312
+ }
1313
+ clear() {
1314
+ this.map1.clear();
1315
+ }
1316
+ get size() {
1317
+ return this.map1.size;
1318
+ }
1319
+ forEach(callbackfn, thisArg) {
1320
+ this.map1.forEach((value, key1) => callbackfn.call(thisArg, value, key1, this));
1321
+ }
1322
+ keys() {
1323
+ return this.map1.keys();
1324
+ }
1325
+ values() {
1326
+ return this.map1.values();
1327
+ }
1328
+ *entries() {
1329
+ for (const [key1, value] of this.map1)
1330
+ yield [key1, value];
1331
+ }
1332
+ *[Symbol.iterator]() {
1333
+ yield* this.entries();
1334
+ }
1335
+ };
1336
+ var Map2 = class {
1337
+ constructor() {
1338
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1339
+ }
1340
+ set(key1, key2, value) {
1341
+ let map2 = this.map1.get(key1) ?? this.map1.set(key1, /* @__PURE__ */ new Map()).get(key1);
1342
+ map2.set(key2, value);
1343
+ return value;
1344
+ }
1345
+ get(key1, key2) {
1346
+ return this.map1.get(key1)?.get(key2);
1347
+ }
1348
+ has(key1, key2) {
1349
+ return this.map1.get(key1)?.has(key2) ?? false;
1350
+ }
1351
+ delete(key1, key2) {
1352
+ if (key2 === void 0) return this.map1.delete(key1);
1353
+ const map2 = this.map1.get(key1);
1354
+ if (!map2) return false;
1355
+ return map2.delete(key2);
1356
+ }
1357
+ clear() {
1358
+ this.map1.clear();
1359
+ }
1360
+ get size() {
1361
+ let count = 0;
1362
+ for (const map2 of this.map1.values()) {
1363
+ count += map2.size;
1364
+ }
1365
+ return count;
1366
+ }
1367
+ forEach(callbackfn, thisArg) {
1368
+ this.map1.forEach((map2, key1) => map2.forEach((value, key2) => callbackfn.call(thisArg, value, key1, key2, this)));
1369
+ }
1370
+ keys() {
1371
+ function* gen(map1) {
1372
+ for (const [k1, map2] of map1)
1373
+ for (const k2 of map2.keys())
1374
+ yield [k1, k2];
1375
+ }
1376
+ return gen(this.map1);
1377
+ }
1378
+ values() {
1379
+ function* gen(map1) {
1380
+ for (const map2 of map1.values())
1381
+ for (const value of map2.values())
1382
+ yield value;
1383
+ }
1384
+ return gen(this.map1);
1385
+ }
1386
+ *entries() {
1387
+ for (const [key1, map2] of this.map1)
1388
+ for (const [key2, value] of map2)
1389
+ yield [key1, key2, value];
1390
+ }
1391
+ *[Symbol.iterator]() {
1392
+ yield* this.entries();
1393
+ }
1394
+ };
1395
+ var Map3 = class {
1396
+ constructor() {
1397
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1398
+ }
1399
+ set(key1, key2, key3, value) {
1400
+ let map2 = this.map1.get(key1);
1401
+ if (!map2) this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
1402
+ let map3 = map2.get(key2);
1403
+ if (!map3) map2.set(key2, map3 = /* @__PURE__ */ new Map());
1404
+ map3.set(key3, value);
1405
+ return value;
1406
+ }
1407
+ get(key1, key2, key3) {
1408
+ return this.map1.get(key1)?.get(key2)?.get(key3);
1409
+ }
1410
+ has(key1, key2, key3) {
1411
+ return this.map1.get(key1)?.get(key2)?.has(key3) ?? false;
1412
+ }
1413
+ delete(key1, key2, key3) {
1414
+ if (key3 === void 0) {
1415
+ if (key2 === void 0) return this.map1.delete(key1);
1416
+ const map2 = this.map1.get(key1);
1417
+ if (!map2) return false;
1418
+ return map2.delete(key2);
1419
+ } else {
1420
+ if (key2 === void 0) return this.map1.delete(key1);
1421
+ const map3 = this.map1.get(key1)?.get(key2);
1422
+ if (!map3) return false;
1423
+ return map3.delete(key3);
1424
+ }
1425
+ }
1426
+ clear() {
1427
+ this.map1.clear();
1428
+ }
1429
+ get size() {
1430
+ let count = 0;
1431
+ for (const map2 of this.map1.values()) {
1432
+ for (const map3 of map2.values()) {
1433
+ count += map3.size;
1434
+ }
1435
+ }
1436
+ return count;
1437
+ }
1438
+ forEach(callbackfn, thisArg) {
1439
+ this.map1.forEach((map2, key1) => map2.forEach((map3, key2) => map3.forEach((value, key3) => callbackfn.call(thisArg, value, key1, key2, key3, this))));
1440
+ }
1441
+ keys() {
1442
+ function* gen(map1) {
1443
+ for (const [k1, map2] of map1)
1444
+ for (const [k2, map3] of map2)
1445
+ for (const k3 of map3.keys())
1446
+ yield [k1, k2, k3];
1447
+ }
1448
+ return gen(this.map1);
1449
+ }
1450
+ values() {
1451
+ function* gen(map1) {
1452
+ for (const map2 of map1.values())
1453
+ for (const map3 of map2.values())
1454
+ for (const value of map3.values())
1455
+ yield value;
1456
+ }
1457
+ return gen(this.map1);
1458
+ }
1459
+ *entries() {
1460
+ for (const [key1, map2] of this.map1)
1461
+ for (const [key2, map3] of map2)
1462
+ for (const [key3, value] of map3)
1463
+ yield [key1, key2, key3, value];
1464
+ }
1465
+ *[Symbol.iterator]() {
1466
+ yield* this.entries();
1467
+ }
1468
+ };
1291
1469
  // Annotate the CommonJS export names for ESM import in node:
1292
1470
  0 && (module.exports = {
1293
1471
  Assert,
1294
1472
  Cookies,
1295
1473
  Device,
1296
1474
  LRUCache,
1475
+ Map1,
1476
+ Map2,
1477
+ Map3,
1297
1478
  SmallIntCache,
1298
1479
  Stack,
1299
1480
  Utils,
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.9.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.12.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) => {
@@ -1261,11 +1261,189 @@ var SmallIntCache = class {
1261
1261
  this.neg = [];
1262
1262
  }
1263
1263
  };
1264
+
1265
+ // src/core/map.ts
1266
+ var Map1 = class {
1267
+ constructor() {
1268
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1269
+ }
1270
+ set(key1, value) {
1271
+ this.map1.set(key1, value);
1272
+ return value;
1273
+ }
1274
+ get(key1) {
1275
+ return this.map1.get(key1);
1276
+ }
1277
+ has(key1) {
1278
+ return this.map1.has(key1);
1279
+ }
1280
+ delete(key1) {
1281
+ return this.map1.delete(key1);
1282
+ }
1283
+ clear() {
1284
+ this.map1.clear();
1285
+ }
1286
+ get size() {
1287
+ return this.map1.size;
1288
+ }
1289
+ forEach(callbackfn, thisArg) {
1290
+ this.map1.forEach((value, key1) => callbackfn.call(thisArg, value, key1, this));
1291
+ }
1292
+ keys() {
1293
+ return this.map1.keys();
1294
+ }
1295
+ values() {
1296
+ return this.map1.values();
1297
+ }
1298
+ *entries() {
1299
+ for (const [key1, value] of this.map1)
1300
+ yield [key1, value];
1301
+ }
1302
+ *[Symbol.iterator]() {
1303
+ yield* this.entries();
1304
+ }
1305
+ };
1306
+ var Map2 = class {
1307
+ constructor() {
1308
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1309
+ }
1310
+ set(key1, key2, value) {
1311
+ let map2 = this.map1.get(key1) ?? this.map1.set(key1, /* @__PURE__ */ new Map()).get(key1);
1312
+ map2.set(key2, value);
1313
+ return value;
1314
+ }
1315
+ get(key1, key2) {
1316
+ return this.map1.get(key1)?.get(key2);
1317
+ }
1318
+ has(key1, key2) {
1319
+ return this.map1.get(key1)?.has(key2) ?? false;
1320
+ }
1321
+ delete(key1, key2) {
1322
+ if (key2 === void 0) return this.map1.delete(key1);
1323
+ const map2 = this.map1.get(key1);
1324
+ if (!map2) return false;
1325
+ return map2.delete(key2);
1326
+ }
1327
+ clear() {
1328
+ this.map1.clear();
1329
+ }
1330
+ get size() {
1331
+ let count = 0;
1332
+ for (const map2 of this.map1.values()) {
1333
+ count += map2.size;
1334
+ }
1335
+ return count;
1336
+ }
1337
+ forEach(callbackfn, thisArg) {
1338
+ this.map1.forEach((map2, key1) => map2.forEach((value, key2) => callbackfn.call(thisArg, value, key1, key2, this)));
1339
+ }
1340
+ keys() {
1341
+ function* gen(map1) {
1342
+ for (const [k1, map2] of map1)
1343
+ for (const k2 of map2.keys())
1344
+ yield [k1, k2];
1345
+ }
1346
+ return gen(this.map1);
1347
+ }
1348
+ values() {
1349
+ function* gen(map1) {
1350
+ for (const map2 of map1.values())
1351
+ for (const value of map2.values())
1352
+ yield value;
1353
+ }
1354
+ return gen(this.map1);
1355
+ }
1356
+ *entries() {
1357
+ for (const [key1, map2] of this.map1)
1358
+ for (const [key2, value] of map2)
1359
+ yield [key1, key2, value];
1360
+ }
1361
+ *[Symbol.iterator]() {
1362
+ yield* this.entries();
1363
+ }
1364
+ };
1365
+ var Map3 = class {
1366
+ constructor() {
1367
+ __publicField(this, "map1", /* @__PURE__ */ new Map());
1368
+ }
1369
+ set(key1, key2, key3, value) {
1370
+ let map2 = this.map1.get(key1);
1371
+ if (!map2) this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
1372
+ let map3 = map2.get(key2);
1373
+ if (!map3) map2.set(key2, map3 = /* @__PURE__ */ new Map());
1374
+ map3.set(key3, value);
1375
+ return value;
1376
+ }
1377
+ get(key1, key2, key3) {
1378
+ return this.map1.get(key1)?.get(key2)?.get(key3);
1379
+ }
1380
+ has(key1, key2, key3) {
1381
+ return this.map1.get(key1)?.get(key2)?.has(key3) ?? false;
1382
+ }
1383
+ delete(key1, key2, key3) {
1384
+ if (key3 === void 0) {
1385
+ if (key2 === void 0) return this.map1.delete(key1);
1386
+ const map2 = this.map1.get(key1);
1387
+ if (!map2) return false;
1388
+ return map2.delete(key2);
1389
+ } else {
1390
+ if (key2 === void 0) return this.map1.delete(key1);
1391
+ const map3 = this.map1.get(key1)?.get(key2);
1392
+ if (!map3) return false;
1393
+ return map3.delete(key3);
1394
+ }
1395
+ }
1396
+ clear() {
1397
+ this.map1.clear();
1398
+ }
1399
+ get size() {
1400
+ let count = 0;
1401
+ for (const map2 of this.map1.values()) {
1402
+ for (const map3 of map2.values()) {
1403
+ count += map3.size;
1404
+ }
1405
+ }
1406
+ return count;
1407
+ }
1408
+ forEach(callbackfn, thisArg) {
1409
+ this.map1.forEach((map2, key1) => map2.forEach((map3, key2) => map3.forEach((value, key3) => callbackfn.call(thisArg, value, key1, key2, key3, this))));
1410
+ }
1411
+ keys() {
1412
+ function* gen(map1) {
1413
+ for (const [k1, map2] of map1)
1414
+ for (const [k2, map3] of map2)
1415
+ for (const k3 of map3.keys())
1416
+ yield [k1, k2, k3];
1417
+ }
1418
+ return gen(this.map1);
1419
+ }
1420
+ values() {
1421
+ function* gen(map1) {
1422
+ for (const map2 of map1.values())
1423
+ for (const map3 of map2.values())
1424
+ for (const value of map3.values())
1425
+ yield value;
1426
+ }
1427
+ return gen(this.map1);
1428
+ }
1429
+ *entries() {
1430
+ for (const [key1, map2] of this.map1)
1431
+ for (const [key2, map3] of map2)
1432
+ for (const [key3, value] of map3)
1433
+ yield [key1, key2, key3, value];
1434
+ }
1435
+ *[Symbol.iterator]() {
1436
+ yield* this.entries();
1437
+ }
1438
+ };
1264
1439
  export {
1265
1440
  Assert,
1266
1441
  Cookies,
1267
1442
  Device,
1268
1443
  LRUCache,
1444
+ Map1,
1445
+ Map2,
1446
+ Map3,
1269
1447
  SmallIntCache,
1270
1448
  Stack,
1271
1449
  utils_exports as Utils,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tspro/ts-utils-lib",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,