data-structure-typed 2.5.1 → 2.5.3
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 +5 -1
- package/MIGRATION.md +169 -0
- package/README.md +135 -23
- package/README_CN.md +551 -143
- package/SPECIFICATION.md +20 -14
- package/SPECIFICATION.zh-CN.md +20 -14
- package/dist/cjs/binary-tree.cjs +6460 -1591
- package/dist/cjs/graph.cjs +440 -20
- package/dist/cjs/hash.cjs +125 -22
- package/dist/cjs/heap.cjs +196 -47
- package/dist/cjs/index.cjs +8486 -2429
- package/dist/cjs/linked-list.cjs +456 -31
- package/dist/cjs/matrix.cjs +79 -9
- package/dist/cjs/priority-queue.cjs +193 -44
- package/dist/cjs/queue.cjs +391 -2
- package/dist/cjs/stack.cjs +92 -6
- package/dist/cjs/trie.cjs +122 -28
- package/dist/cjs-legacy/binary-tree.cjs +6484 -1612
- package/dist/cjs-legacy/graph.cjs +440 -20
- package/dist/cjs-legacy/hash.cjs +125 -22
- package/dist/cjs-legacy/heap.cjs +196 -47
- package/dist/cjs-legacy/index.cjs +8654 -2594
- package/dist/cjs-legacy/linked-list.cjs +456 -31
- package/dist/cjs-legacy/matrix.cjs +79 -9
- package/dist/cjs-legacy/priority-queue.cjs +193 -44
- package/dist/cjs-legacy/queue.cjs +391 -2
- package/dist/cjs-legacy/stack.cjs +92 -6
- package/dist/cjs-legacy/trie.cjs +122 -28
- package/dist/esm/binary-tree.mjs +6460 -1591
- package/dist/esm/graph.mjs +440 -20
- package/dist/esm/hash.mjs +125 -22
- package/dist/esm/heap.mjs +196 -47
- package/dist/esm/index.mjs +8486 -2430
- package/dist/esm/linked-list.mjs +456 -31
- package/dist/esm/matrix.mjs +79 -9
- package/dist/esm/priority-queue.mjs +193 -44
- package/dist/esm/queue.mjs +391 -2
- package/dist/esm/stack.mjs +92 -6
- package/dist/esm/trie.mjs +122 -28
- package/dist/esm-legacy/binary-tree.mjs +6484 -1612
- package/dist/esm-legacy/graph.mjs +440 -20
- package/dist/esm-legacy/hash.mjs +125 -22
- package/dist/esm-legacy/heap.mjs +196 -47
- package/dist/esm-legacy/index.mjs +8654 -2595
- package/dist/esm-legacy/linked-list.mjs +456 -31
- package/dist/esm-legacy/matrix.mjs +79 -9
- package/dist/esm-legacy/priority-queue.mjs +193 -44
- package/dist/esm-legacy/queue.mjs +391 -2
- package/dist/esm-legacy/stack.mjs +92 -6
- package/dist/esm-legacy/trie.mjs +122 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +98 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +112 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +214 -13
- package/dist/types/data-structures/binary-tree/bst.d.ts +294 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +155 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1370 -323
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1329 -316
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +1116 -295
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1330 -326
- package/dist/types/data-structures/graph/directed-graph.d.ts +80 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +72 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +95 -6
- package/dist/types/data-structures/heap/heap.d.ts +154 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +143 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +144 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +64 -0
- package/dist/types/data-structures/queue/deque.d.ts +142 -0
- package/dist/types/data-structures/queue/queue.d.ts +109 -0
- package/dist/types/data-structures/stack/stack.d.ts +82 -2
- package/dist/types/data-structures/trie/trie.d.ts +96 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +8623 -2564
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +696 -194
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +639 -189
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +148 -160
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +105 -91
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +104 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +51 -51
- package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
- package/docs-site-docusaurus/docs/api/classes/Queue.md +112 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +708 -206
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +79 -79
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +236 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +232 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -5
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -3
- package/docs-site-docusaurus/docs/guide/faq.md +233 -0
- package/docs-site-docusaurus/docs/guide/guides.md +43 -58
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +75 -176
- package/docs-site-docusaurus/docs/guide/overview.md +132 -11
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +55 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/llms.txt +37 -0
- package/package.json +65 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +99 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
- package/src/data-structures/binary-tree/binary-tree.ts +239 -78
- package/src/data-structures/binary-tree/bst.ts +542 -13
- package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +1223 -261
- package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
- package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
- package/src/data-structures/binary-tree/tree-set.ts +1018 -99
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +102 -16
- package/src/data-structures/heap/heap.ts +153 -23
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
- package/src/data-structures/matrix/matrix.ts +65 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +130 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +86 -2
- package/src/interfaces/binary-tree.ts +1 -9
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
package/dist/esm/hash.mjs
CHANGED
|
@@ -183,18 +183,11 @@ var IterableEntryBase = class {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
// src/utils/utils.ts
|
|
187
|
-
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
188
|
-
if (index < min || index > max) {
|
|
189
|
-
throw new RangeError(message ?? `Index ${index} is out of range [${min}, ${max}].`);
|
|
190
|
-
}
|
|
191
|
-
}, "rangeCheck");
|
|
192
|
-
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
193
|
-
const inputType = typeof input;
|
|
194
|
-
return inputType === "object" && input !== null || inputType === "function";
|
|
195
|
-
}, "isWeakKey");
|
|
196
|
-
|
|
197
186
|
// src/common/error.ts
|
|
187
|
+
function raise(ErrorClass, message) {
|
|
188
|
+
throw new ErrorClass(message);
|
|
189
|
+
}
|
|
190
|
+
__name(raise, "raise");
|
|
198
191
|
var ERR = {
|
|
199
192
|
// Range / index
|
|
200
193
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -216,9 +209,22 @@ var ERR = {
|
|
|
216
209
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
217
210
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
218
211
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
219
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
212
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
213
|
+
// Order statistic
|
|
214
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
220
215
|
};
|
|
221
216
|
|
|
217
|
+
// src/utils/utils.ts
|
|
218
|
+
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
219
|
+
if (index < min || index > max) {
|
|
220
|
+
throw new RangeError(message ?? `Index ${index} is out of range [${min}, ${max}].`);
|
|
221
|
+
}
|
|
222
|
+
}, "rangeCheck");
|
|
223
|
+
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
224
|
+
const inputType = typeof input;
|
|
225
|
+
return inputType === "object" && input !== null || inputType === "function";
|
|
226
|
+
}, "isWeakKey");
|
|
227
|
+
|
|
222
228
|
// src/data-structures/hash/hash-map.ts
|
|
223
229
|
var HashMap = class extends IterableEntryBase {
|
|
224
230
|
static {
|
|
@@ -309,6 +315,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
309
315
|
|
|
310
316
|
|
|
311
317
|
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
312
326
|
|
|
313
327
|
|
|
314
328
|
|
|
@@ -350,6 +364,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
350
364
|
|
|
351
365
|
|
|
352
366
|
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
353
375
|
|
|
354
376
|
|
|
355
377
|
|
|
@@ -429,6 +451,22 @@ var HashMap = class extends IterableEntryBase {
|
|
|
429
451
|
|
|
430
452
|
|
|
431
453
|
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
432
470
|
|
|
433
471
|
|
|
434
472
|
|
|
@@ -474,7 +512,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
474
512
|
if (this.store[strKey] === void 0) this._size++;
|
|
475
513
|
this._store[strKey] = { key, value };
|
|
476
514
|
}
|
|
477
|
-
return
|
|
515
|
+
return this;
|
|
478
516
|
}
|
|
479
517
|
/**
|
|
480
518
|
* Insert many entries from an iterable.
|
|
@@ -501,6 +539,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
501
539
|
|
|
502
540
|
|
|
503
541
|
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
504
550
|
|
|
505
551
|
|
|
506
552
|
|
|
@@ -522,7 +568,11 @@ var HashMap = class extends IterableEntryBase {
|
|
|
522
568
|
let key, value;
|
|
523
569
|
if (this.isEntry(rawEle)) [key, value] = rawEle;
|
|
524
570
|
else if (this._toEntryFn) [key, value] = this._toEntryFn(rawEle);
|
|
525
|
-
if (key !== void 0 && value !== void 0)
|
|
571
|
+
if (key !== void 0 && value !== void 0) {
|
|
572
|
+
const sizeBefore = this._size;
|
|
573
|
+
this.set(key, value);
|
|
574
|
+
results.push(sizeBefore < this._size);
|
|
575
|
+
}
|
|
526
576
|
}
|
|
527
577
|
return results;
|
|
528
578
|
}
|
|
@@ -553,6 +603,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
553
603
|
|
|
554
604
|
|
|
555
605
|
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
556
614
|
|
|
557
615
|
|
|
558
616
|
|
|
@@ -616,6 +674,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
616
674
|
|
|
617
675
|
|
|
618
676
|
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
619
685
|
|
|
620
686
|
|
|
621
687
|
|
|
@@ -664,6 +730,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
664
730
|
|
|
665
731
|
|
|
666
732
|
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
667
741
|
|
|
668
742
|
|
|
669
743
|
|
|
@@ -730,6 +804,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
730
804
|
|
|
731
805
|
|
|
732
806
|
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
733
815
|
|
|
734
816
|
|
|
735
817
|
|
|
@@ -779,6 +861,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
779
861
|
|
|
780
862
|
|
|
781
863
|
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
782
872
|
|
|
783
873
|
|
|
784
874
|
|
|
@@ -830,6 +920,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
830
920
|
|
|
831
921
|
|
|
832
922
|
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
833
931
|
|
|
834
932
|
|
|
835
933
|
|
|
@@ -988,9 +1086,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
988
1086
|
if (this.isEntry(rawElement)) {
|
|
989
1087
|
return rawElement;
|
|
990
1088
|
}
|
|
991
|
-
|
|
992
|
-
ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap")
|
|
993
|
-
);
|
|
1089
|
+
raise(TypeError, ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap"));
|
|
994
1090
|
}, "_toEntryFn");
|
|
995
1091
|
get toEntryFn() {
|
|
996
1092
|
return this._toEntryFn;
|
|
@@ -1046,7 +1142,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1046
1142
|
* @remarks Time O(1), Space O(1)
|
|
1047
1143
|
* @param key - Key.
|
|
1048
1144
|
* @param [value] - Value.
|
|
1049
|
-
* @returns
|
|
1145
|
+
* @returns This map (for chaining).
|
|
1050
1146
|
*/
|
|
1051
1147
|
set(key, value) {
|
|
1052
1148
|
let node;
|
|
@@ -1081,7 +1177,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1081
1177
|
this._sentinel.prev = node;
|
|
1082
1178
|
this._size++;
|
|
1083
1179
|
}
|
|
1084
|
-
return
|
|
1180
|
+
return this;
|
|
1085
1181
|
}
|
|
1086
1182
|
setMany(entryOrRawElements) {
|
|
1087
1183
|
const results = [];
|
|
@@ -1089,7 +1185,11 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1089
1185
|
let key, value;
|
|
1090
1186
|
if (this.isEntry(rawEle)) [key, value] = rawEle;
|
|
1091
1187
|
else if (this._toEntryFn) [key, value] = this._toEntryFn(rawEle);
|
|
1092
|
-
if (key !== void 0 && value !== void 0)
|
|
1188
|
+
if (key !== void 0 && value !== void 0) {
|
|
1189
|
+
const sizeBefore = this._size;
|
|
1190
|
+
this.set(key, value);
|
|
1191
|
+
results.push(sizeBefore < this._size);
|
|
1192
|
+
}
|
|
1093
1193
|
}
|
|
1094
1194
|
return results;
|
|
1095
1195
|
}
|
|
@@ -1167,13 +1267,16 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1167
1267
|
* Delete the entry at a given index.
|
|
1168
1268
|
* @remarks Time O(N), Space O(1)
|
|
1169
1269
|
* @param index - Zero-based index.
|
|
1170
|
-
* @returns
|
|
1270
|
+
* @returns The removed entry [key, value].
|
|
1271
|
+
* @throws {RangeError} If index is out of bounds.
|
|
1171
1272
|
*/
|
|
1172
1273
|
deleteAt(index) {
|
|
1173
1274
|
rangeCheck(index, 0, this._size - 1);
|
|
1174
1275
|
let node = this.head;
|
|
1175
1276
|
while (index--) node = node.next;
|
|
1176
|
-
|
|
1277
|
+
const entry = [node.key, node.value];
|
|
1278
|
+
this._deleteNode(node);
|
|
1279
|
+
return entry;
|
|
1177
1280
|
}
|
|
1178
1281
|
isEmpty() {
|
|
1179
1282
|
return this._size === 0;
|