max-priority-queue-typed 2.4.5 → 2.5.1

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.
Files changed (94) hide show
  1. package/README.md +63 -0
  2. package/dist/cjs/index.cjs +694 -119
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs-legacy/index.cjs +693 -118
  5. package/dist/cjs-legacy/index.cjs.map +1 -1
  6. package/dist/esm/index.mjs +694 -119
  7. package/dist/esm/index.mjs.map +1 -1
  8. package/dist/esm-legacy/index.mjs +693 -118
  9. package/dist/esm-legacy/index.mjs.map +1 -1
  10. package/dist/types/data-structures/base/index.d.ts +1 -0
  11. package/dist/types/data-structures/base/iterable-element-base.d.ts +1 -1
  12. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  13. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  14. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +380 -51
  15. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +487 -147
  16. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +956 -80
  17. package/dist/types/data-structures/binary-tree/bst.d.ts +816 -29
  18. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +610 -31
  19. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +326 -135
  20. package/dist/types/data-structures/binary-tree/tree-map.d.ts +3781 -6
  21. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3607 -201
  22. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2874 -65
  23. package/dist/types/data-structures/binary-tree/tree-set.d.ts +3528 -6
  24. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  25. package/dist/types/data-structures/graph/directed-graph.d.ts +429 -47
  26. package/dist/types/data-structures/graph/map-graph.d.ts +59 -1
  27. package/dist/types/data-structures/graph/undirected-graph.d.ts +393 -59
  28. package/dist/types/data-structures/hash/hash-map.d.ts +473 -89
  29. package/dist/types/data-structures/heap/heap.d.ts +581 -99
  30. package/dist/types/data-structures/heap/max-heap.d.ts +46 -0
  31. package/dist/types/data-structures/heap/min-heap.d.ts +59 -0
  32. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +646 -47
  33. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +596 -68
  34. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +793 -12
  35. package/dist/types/data-structures/matrix/matrix.d.ts +499 -0
  36. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +57 -0
  37. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +60 -0
  38. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +60 -0
  39. package/dist/types/data-structures/queue/deque.d.ts +593 -71
  40. package/dist/types/data-structures/queue/queue.d.ts +463 -42
  41. package/dist/types/data-structures/stack/stack.d.ts +384 -32
  42. package/dist/types/data-structures/trie/trie.d.ts +470 -48
  43. package/dist/types/interfaces/graph.d.ts +1 -1
  44. package/dist/types/types/common.d.ts +2 -2
  45. package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -1
  46. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  47. package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +1 -4
  48. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  49. package/dist/types/types/utils/validate-type.d.ts +4 -4
  50. package/dist/umd/max-priority-queue-typed.js +691 -116
  51. package/dist/umd/max-priority-queue-typed.js.map +1 -1
  52. package/dist/umd/max-priority-queue-typed.min.js +1 -1
  53. package/dist/umd/max-priority-queue-typed.min.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/data-structures/base/index.ts +1 -0
  56. package/src/data-structures/base/iterable-element-base.ts +4 -5
  57. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  58. package/src/data-structures/base/linear-base.ts +3 -3
  59. package/src/data-structures/binary-tree/avl-tree.ts +386 -51
  60. package/src/data-structures/binary-tree/binary-indexed-tree.ts +596 -247
  61. package/src/data-structures/binary-tree/binary-tree.ts +956 -81
  62. package/src/data-structures/binary-tree/bst.ts +840 -35
  63. package/src/data-structures/binary-tree/red-black-tree.ts +689 -97
  64. package/src/data-structures/binary-tree/segment-tree.ts +498 -249
  65. package/src/data-structures/binary-tree/tree-map.ts +3784 -7
  66. package/src/data-structures/binary-tree/tree-multi-map.ts +3614 -211
  67. package/src/data-structures/binary-tree/tree-multi-set.ts +2874 -65
  68. package/src/data-structures/binary-tree/tree-set.ts +3531 -10
  69. package/src/data-structures/graph/abstract-graph.ts +4 -4
  70. package/src/data-structures/graph/directed-graph.ts +429 -47
  71. package/src/data-structures/graph/map-graph.ts +59 -1
  72. package/src/data-structures/graph/undirected-graph.ts +393 -59
  73. package/src/data-structures/hash/hash-map.ts +476 -92
  74. package/src/data-structures/heap/heap.ts +581 -99
  75. package/src/data-structures/heap/max-heap.ts +46 -0
  76. package/src/data-structures/heap/min-heap.ts +59 -0
  77. package/src/data-structures/linked-list/doubly-linked-list.ts +646 -47
  78. package/src/data-structures/linked-list/singly-linked-list.ts +596 -68
  79. package/src/data-structures/linked-list/skip-linked-list.ts +1067 -90
  80. package/src/data-structures/matrix/matrix.ts +584 -12
  81. package/src/data-structures/priority-queue/max-priority-queue.ts +57 -0
  82. package/src/data-structures/priority-queue/min-priority-queue.ts +60 -0
  83. package/src/data-structures/priority-queue/priority-queue.ts +60 -0
  84. package/src/data-structures/queue/deque.ts +592 -70
  85. package/src/data-structures/queue/queue.ts +463 -42
  86. package/src/data-structures/stack/stack.ts +384 -32
  87. package/src/data-structures/trie/trie.ts +470 -48
  88. package/src/interfaces/graph.ts +1 -1
  89. package/src/types/common.ts +2 -2
  90. package/src/types/data-structures/binary-tree/segment-tree.ts +1 -1
  91. package/src/types/data-structures/heap/heap.ts +1 -0
  92. package/src/types/data-structures/linked-list/skip-linked-list.ts +2 -1
  93. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  94. package/src/types/utils/validate-type.ts +4 -4
@@ -18,71 +18,6 @@ import { LinearBase } from '../base/linear-base';
18
18
  * 4. Efficiency: Adding and removing elements at both ends of a deque is usually very fast. However, when the dynamic array needs to expand, it may involve copying the entire array to a larger one, and this operation has a time complexity of O(n).
19
19
  * 5. Performance jitter: Deque may experience performance jitter, but DoublyLinkedList will not
20
20
  * @example
21
- * // basic Deque creation and push/pop operations
22
- * // Create a simple Deque with initial values
23
- * const deque = new Deque([1, 2, 3, 4, 5]);
24
- *
25
- * // Verify the deque maintains insertion order
26
- * console.log([...deque]); // [1, 2, 3, 4, 5];
27
- *
28
- * // Check length
29
- * console.log(deque.length); // 5;
30
- *
31
- * // Push to the end
32
- * deque.push(6);
33
- * console.log(deque.length); // 6;
34
- *
35
- * // Pop from the end
36
- * const last = deque.pop();
37
- * console.log(last); // 6;
38
- * @example
39
- * // Deque shift and unshift operations
40
- * const deque = new Deque<number>([20, 30, 40]);
41
- *
42
- * // Unshift adds to the front
43
- * deque.unshift(10);
44
- * console.log([...deque]); // [10, 20, 30, 40];
45
- *
46
- * // Shift removes from the front (O(1) complexity!)
47
- * const first = deque.shift();
48
- * console.log(first); // 10;
49
- *
50
- * // Verify remaining elements
51
- * console.log([...deque]); // [20, 30, 40];
52
- * console.log(deque.length); // 3;
53
- * @example
54
- * // Deque peek at both ends
55
- * const deque = new Deque<number>([10, 20, 30, 40, 50]);
56
- *
57
- * // Get first element without removing
58
- * const first = deque.at(0);
59
- * console.log(first); // 10;
60
- *
61
- * // Get last element without removing
62
- * const last = deque.at(deque.length - 1);
63
- * console.log(last); // 50;
64
- *
65
- * // Length unchanged
66
- * console.log(deque.length); // 5;
67
- * @example
68
- * // Deque for...of iteration and reverse
69
- * const deque = new Deque<string>(['A', 'B', 'C', 'D']);
70
- *
71
- * // Iterate forward
72
- * const forward: string[] = [];
73
- * for (const item of deque) {
74
- * forward.push(item);
75
- * }
76
- * console.log(forward); // ['A', 'B', 'C', 'D'];
77
- *
78
- * // Reverse the deque
79
- * deque.reverse();
80
- * const backward: string[] = [];
81
- * for (const item of deque) {
82
- * backward.push(item);
83
- * }
84
- * console.log(backward); // ['D', 'C', 'B', 'A'];
85
- * @example
86
21
  * // Deque as sliding window for stream processing
87
22
  * interface DataPoint {
88
23
  * timestamp: number;
@@ -133,6 +68,10 @@ import { LinearBase } from '../base/linear-base';
133
68
  * console.log(windowResults[2].windowSize); // 3; // Windows are at max size from 3rd onwards
134
69
  * console.log(windowResults[4].windowSize); // 3; // Last window still has 3 elements
135
70
  * console.log(dataWindow.length); // 3;
71
+ * @example
72
+ * // Convert deque to array
73
+ * const dq = new Deque<number>([10, 20, 30]);
74
+ * console.log(dq.toArray()); // [10, 20, 30];
136
75
  */
137
76
  export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
138
77
  protected _equals: (a: E, b: E) => boolean;
@@ -227,12 +166,95 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
227
166
  * Get the first element without removing it.
228
167
  * @remarks Time O(1), Space O(1)
229
168
  * @returns First element or undefined.
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ * @example
202
+ * // Deque peek at both ends
203
+ * const deque = new Deque<number>([10, 20, 30, 40, 50]);
204
+ *
205
+ * // Get first element without removing
206
+ * const first = deque.at(0);
207
+ * console.log(first); // 10;
208
+ *
209
+ * // Get last element without removing
210
+ * const last = deque.at(deque.length - 1);
211
+ * console.log(last); // 50;
212
+ *
213
+ * // Length unchanged
214
+ * console.log(deque.length); // 5;
230
215
  */
231
216
  get first(): E | undefined;
232
217
  /**
233
218
  * Get the last element without removing it.
234
219
  * @remarks Time O(1), Space O(1)
235
220
  * @returns Last element or undefined.
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+ * @example
254
+ * // Peek at the back element
255
+ * const dq = new Deque<string>(['a', 'b', 'c']);
256
+ * console.log(dq.last); // 'c';
257
+ * console.log(dq.first); // 'a';
236
258
  */
237
259
  get last(): E | undefined;
238
260
  /**
@@ -251,18 +273,142 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
251
273
  * @remarks Time O(1) amortized, Space O(1)
252
274
  * @param element - Element to append.
253
275
  * @returns True when appended.
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+ * @example
309
+ * // basic Deque creation and push/pop operations
310
+ * // Create a simple Deque with initial values
311
+ * const deque = new Deque([1, 2, 3, 4, 5]);
312
+ *
313
+ * // Verify the deque maintains insertion order
314
+ * console.log([...deque]); // [1, 2, 3, 4, 5];
315
+ *
316
+ * // Check length
317
+ * console.log(deque.length); // 5;
318
+ *
319
+ * // Push to the end
320
+ * deque.push(6);
321
+ * console.log(deque.length); // 6;
322
+ *
323
+ * // Pop from the end
324
+ * const last = deque.pop();
325
+ * console.log(last); // 6;
254
326
  */
255
327
  push(element: E): boolean;
256
328
  /**
257
329
  * Remove and return the last element.
258
330
  * @remarks Time O(1), Space O(1)
259
331
  * @returns Removed element or undefined.
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+ * @example
365
+ * // Remove from the back
366
+ * const dq = new Deque<number>([1, 2, 3]);
367
+ * console.log(dq.pop()); // 3;
368
+ * console.log(dq.length); // 2;
260
369
  */
261
370
  pop(): E | undefined;
262
371
  /**
263
372
  * Remove and return the first element.
264
373
  * @remarks Time O(1) amortized, Space O(1)
265
374
  * @returns Removed element or undefined.
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+ * @example
408
+ * // Remove from the front
409
+ * const dq = new Deque<number>([1, 2, 3]);
410
+ * console.log(dq.shift()); // 1;
411
+ * console.log(dq.length); // 2;
266
412
  */
267
413
  shift(): E | undefined;
268
414
  /**
@@ -270,6 +416,53 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
270
416
  * @remarks Time O(1) amortized, Space O(1)
271
417
  * @param element - Element to prepend.
272
418
  * @returns True when prepended.
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+ * @example
452
+ * // Deque shift and unshift operations
453
+ * const deque = new Deque<number>([20, 30, 40]);
454
+ *
455
+ * // Unshift adds to the front
456
+ * deque.unshift(10);
457
+ * console.log([...deque]); // [10, 20, 30, 40];
458
+ *
459
+ * // Shift removes from the front (O(1) complexity!)
460
+ * const first = deque.shift();
461
+ * console.log(first); // 10;
462
+ *
463
+ * // Verify remaining elements
464
+ * console.log([...deque]); // [20, 30, 40];
465
+ * console.log(deque.length); // 3;
273
466
  */
274
467
  unshift(element: E): boolean;
275
468
  /**
@@ -290,12 +483,81 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
290
483
  * Check whether the deque is empty.
291
484
  * @remarks Time O(1), Space O(1)
292
485
  * @returns True if length is 0.
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+ * @example
517
+ * // Check if empty
518
+ * const dq = new Deque();
519
+ * console.log(dq.isEmpty()); // true;
293
520
  */
294
521
  isEmpty(): boolean;
295
522
  /**
296
523
  * Remove all elements and reset structure.
297
524
  * @remarks Time O(1), Space O(1)
298
525
  * @returns void
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+ * @example
557
+ * // Remove all elements
558
+ * const dq = new Deque<number>([1, 2, 3]);
559
+ * dq.clear();
560
+ * console.log(dq.length); // 0;
299
561
  */
300
562
  clear(): void;
301
563
  /**
@@ -303,6 +565,40 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
303
565
  * @remarks Time O(1), Space O(1)
304
566
  * @param pos - Zero-based position from the front.
305
567
  * @returns Element or undefined.
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+ * @example
598
+ * // Access by index
599
+ * const dq = new Deque<string>(['a', 'b', 'c']);
600
+ * console.log(dq.at(0)); // 'a';
601
+ * console.log(dq.at(2)); // 'c';
306
602
  */
307
603
  at(pos: number): E | undefined;
308
604
  /**
@@ -359,6 +655,40 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
359
655
  * @remarks Time O(N), Space O(1)
360
656
  * @param element - Element to remove (using the configured equality).
361
657
  * @returns True if an element was removed.
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+ * @example
688
+ * // Remove element
689
+ * const dq = new Deque<number>([1, 2, 3]);
690
+ * dq.delete(2);
691
+ * console.log(dq.length); // 2;
362
692
  */
363
693
  delete(element: E): boolean;
364
694
  /**
@@ -379,6 +709,56 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
379
709
  * Reverse the deque by reversing buckets and pointers.
380
710
  * @remarks Time O(N), Space O(N)
381
711
  * @returns This deque.
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+ * @example
745
+ * // Deque for...of iteration and reverse
746
+ * const deque = new Deque<string>(['A', 'B', 'C', 'D']);
747
+ *
748
+ * // Iterate forward
749
+ * const forward: string[] = [];
750
+ * for (const item of deque) {
751
+ * forward.push(item);
752
+ * }
753
+ * console.log(forward); // ['A', 'B', 'C', 'D'];
754
+ *
755
+ * // Reverse the deque
756
+ * deque.reverse();
757
+ * const backward: string[] = [];
758
+ * for (const item of deque) {
759
+ * backward.push(item);
760
+ * }
761
+ * console.log(backward); // ['D', 'C', 'B', 'A'];
382
762
  */
383
763
  reverse(): this;
384
764
  /**
@@ -407,6 +787,42 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
407
787
  * Compact the deque by removing unused buckets.
408
788
  * @remarks Time O(N), Space O(1)
409
789
  * @returns True if compaction was performed (bucket count reduced).
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+ * @example
820
+ * // Reclaim memory
821
+ * const dq = new Deque<number>([1, 2, 3, 4, 5]);
822
+ * dq.shift();
823
+ * dq.shift();
824
+ * dq.compact();
825
+ * console.log(dq.length); // 3;
410
826
  */
411
827
  compact(): boolean;
412
828
  shrinkToFit(): void;
@@ -414,6 +830,43 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
414
830
  * Deep clone this deque, preserving options.
415
831
  * @remarks Time O(N), Space O(N)
416
832
  * @returns A new deque with the same content and options.
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
+
863
+ * @example
864
+ * // Create independent copy
865
+ * const dq = new Deque<number>([1, 2, 3]);
866
+ * const copy = dq.clone();
867
+ * copy.pop();
868
+ * console.log(dq.length); // 3;
869
+ * console.log(copy.length); // 2;
417
870
  */
418
871
  clone(): this;
419
872
  /**
@@ -422,8 +875,43 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
422
875
  * @param predicate - Predicate (value, index, deque) → boolean to keep element.
423
876
  * @param [thisArg] - Value for `this` inside the predicate.
424
877
  * @returns A new deque with kept elements.
425
- */
426
- filter(predicate: ElementCallback<E, R, boolean>, thisArg?: any): this;
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+
892
+
893
+
894
+
895
+
896
+
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+ * @example
909
+ * // Filter elements
910
+ * const dq = new Deque<number>([1, 2, 3, 4]);
911
+ * const result = dq.filter(x => x > 2);
912
+ * console.log(result.length); // 2;
913
+ */
914
+ filter(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): this;
427
915
  /**
428
916
  * Map elements into a new deque of the same element type.
429
917
  * @remarks Time O(N), Space O(N)
@@ -431,7 +919,7 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
431
919
  * @param [thisArg] - Value for `this` inside the callback.
432
920
  * @returns A new deque with mapped values.
433
921
  */
434
- mapSame(callback: ElementCallback<E, R, E>, thisArg?: any): this;
922
+ mapSame(callback: ElementCallback<E, R, E>, thisArg?: unknown): this;
435
923
  /**
436
924
  * Map elements into a new deque (possibly different element type).
437
925
  * @remarks Time O(N), Space O(N)
@@ -441,8 +929,42 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
441
929
  * @param [options] - Options for the output deque (e.g., bucketSize, toElementFn, maxLen).
442
930
  * @param [thisArg] - Value for `this` inside the callback.
443
931
  * @returns A new Deque with mapped elements.
444
- */
445
- map<EM, RM>(callback: ElementCallback<E, R, EM>, options?: IterableElementBaseOptions<EM, RM>, thisArg?: any): Deque<EM, RM>;
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+ * @example
962
+ * // Transform elements
963
+ * const dq = new Deque<number>([1, 2, 3]);
964
+ * const result = dq.map(x => x * 10);
965
+ * console.log(result.toArray()); // [10, 20, 30];
966
+ */
967
+ map<EM, RM>(callback: ElementCallback<E, R, EM>, options?: IterableElementBaseOptions<EM, RM>, thisArg?: unknown): Deque<EM, RM>;
446
968
  /**
447
969
  * (Protected) Set the internal bucket size.
448
970
  * @remarks Time O(1), Space O(1)
@@ -489,7 +1011,7 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
489
1011
  * @param [options] - Options forwarded to the constructor.
490
1012
  * @returns A like-kind Deque instance.
491
1013
  */
492
- protected _createLike<T = E, RR = R>(elements?: IterableWithSizeOrLength<T> | IterableWithSizeOrLength<RR>, options?: DequeOptions<T, RR>): any;
1014
+ protected _createLike<T = E, RR = R>(elements?: IterableWithSizeOrLength<T> | IterableWithSizeOrLength<RR>, options?: DequeOptions<T, RR>): Deque<T, RR>;
493
1015
  /**
494
1016
  * (Protected) Iterate elements from back to front.
495
1017
  * @remarks Time O(N), Space O(1)