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/cjs/hash.cjs
CHANGED
|
@@ -185,18 +185,11 @@ var IterableEntryBase = class {
|
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
// src/utils/utils.ts
|
|
189
|
-
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
190
|
-
if (index < min || index > max) {
|
|
191
|
-
throw new RangeError(message ?? `Index ${index} is out of range [${min}, ${max}].`);
|
|
192
|
-
}
|
|
193
|
-
}, "rangeCheck");
|
|
194
|
-
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
195
|
-
const inputType = typeof input;
|
|
196
|
-
return inputType === "object" && input !== null || inputType === "function";
|
|
197
|
-
}, "isWeakKey");
|
|
198
|
-
|
|
199
188
|
// src/common/error.ts
|
|
189
|
+
function raise(ErrorClass, message) {
|
|
190
|
+
throw new ErrorClass(message);
|
|
191
|
+
}
|
|
192
|
+
__name(raise, "raise");
|
|
200
193
|
var ERR = {
|
|
201
194
|
// Range / index
|
|
202
195
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -218,9 +211,22 @@ var ERR = {
|
|
|
218
211
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
219
212
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
220
213
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
221
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
214
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
215
|
+
// Order statistic
|
|
216
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
222
217
|
};
|
|
223
218
|
|
|
219
|
+
// src/utils/utils.ts
|
|
220
|
+
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
221
|
+
if (index < min || index > max) {
|
|
222
|
+
throw new RangeError(message ?? `Index ${index} is out of range [${min}, ${max}].`);
|
|
223
|
+
}
|
|
224
|
+
}, "rangeCheck");
|
|
225
|
+
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
226
|
+
const inputType = typeof input;
|
|
227
|
+
return inputType === "object" && input !== null || inputType === "function";
|
|
228
|
+
}, "isWeakKey");
|
|
229
|
+
|
|
224
230
|
// src/data-structures/hash/hash-map.ts
|
|
225
231
|
var HashMap = class extends IterableEntryBase {
|
|
226
232
|
static {
|
|
@@ -311,6 +317,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
311
317
|
|
|
312
318
|
|
|
313
319
|
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
314
328
|
|
|
315
329
|
|
|
316
330
|
|
|
@@ -352,6 +366,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
352
366
|
|
|
353
367
|
|
|
354
368
|
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
355
377
|
|
|
356
378
|
|
|
357
379
|
|
|
@@ -431,6 +453,22 @@ var HashMap = class extends IterableEntryBase {
|
|
|
431
453
|
|
|
432
454
|
|
|
433
455
|
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
434
472
|
|
|
435
473
|
|
|
436
474
|
|
|
@@ -476,7 +514,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
476
514
|
if (this.store[strKey] === void 0) this._size++;
|
|
477
515
|
this._store[strKey] = { key, value };
|
|
478
516
|
}
|
|
479
|
-
return
|
|
517
|
+
return this;
|
|
480
518
|
}
|
|
481
519
|
/**
|
|
482
520
|
* Insert many entries from an iterable.
|
|
@@ -503,6 +541,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
503
541
|
|
|
504
542
|
|
|
505
543
|
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
506
552
|
|
|
507
553
|
|
|
508
554
|
|
|
@@ -524,7 +570,11 @@ var HashMap = class extends IterableEntryBase {
|
|
|
524
570
|
let key, value;
|
|
525
571
|
if (this.isEntry(rawEle)) [key, value] = rawEle;
|
|
526
572
|
else if (this._toEntryFn) [key, value] = this._toEntryFn(rawEle);
|
|
527
|
-
if (key !== void 0 && value !== void 0)
|
|
573
|
+
if (key !== void 0 && value !== void 0) {
|
|
574
|
+
const sizeBefore = this._size;
|
|
575
|
+
this.set(key, value);
|
|
576
|
+
results.push(sizeBefore < this._size);
|
|
577
|
+
}
|
|
528
578
|
}
|
|
529
579
|
return results;
|
|
530
580
|
}
|
|
@@ -555,6 +605,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
555
605
|
|
|
556
606
|
|
|
557
607
|
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
558
616
|
|
|
559
617
|
|
|
560
618
|
|
|
@@ -618,6 +676,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
618
676
|
|
|
619
677
|
|
|
620
678
|
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
621
687
|
|
|
622
688
|
|
|
623
689
|
|
|
@@ -666,6 +732,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
666
732
|
|
|
667
733
|
|
|
668
734
|
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
669
743
|
|
|
670
744
|
|
|
671
745
|
|
|
@@ -732,6 +806,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
732
806
|
|
|
733
807
|
|
|
734
808
|
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
735
817
|
|
|
736
818
|
|
|
737
819
|
|
|
@@ -781,6 +863,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
781
863
|
|
|
782
864
|
|
|
783
865
|
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
784
874
|
|
|
785
875
|
|
|
786
876
|
|
|
@@ -832,6 +922,14 @@ var HashMap = class extends IterableEntryBase {
|
|
|
832
922
|
|
|
833
923
|
|
|
834
924
|
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
835
933
|
|
|
836
934
|
|
|
837
935
|
|
|
@@ -990,9 +1088,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
990
1088
|
if (this.isEntry(rawElement)) {
|
|
991
1089
|
return rawElement;
|
|
992
1090
|
}
|
|
993
|
-
|
|
994
|
-
ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap")
|
|
995
|
-
);
|
|
1091
|
+
raise(TypeError, ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap"));
|
|
996
1092
|
}, "_toEntryFn");
|
|
997
1093
|
get toEntryFn() {
|
|
998
1094
|
return this._toEntryFn;
|
|
@@ -1048,7 +1144,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1048
1144
|
* @remarks Time O(1), Space O(1)
|
|
1049
1145
|
* @param key - Key.
|
|
1050
1146
|
* @param [value] - Value.
|
|
1051
|
-
* @returns
|
|
1147
|
+
* @returns This map (for chaining).
|
|
1052
1148
|
*/
|
|
1053
1149
|
set(key, value) {
|
|
1054
1150
|
let node;
|
|
@@ -1083,7 +1179,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1083
1179
|
this._sentinel.prev = node;
|
|
1084
1180
|
this._size++;
|
|
1085
1181
|
}
|
|
1086
|
-
return
|
|
1182
|
+
return this;
|
|
1087
1183
|
}
|
|
1088
1184
|
setMany(entryOrRawElements) {
|
|
1089
1185
|
const results = [];
|
|
@@ -1091,7 +1187,11 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1091
1187
|
let key, value;
|
|
1092
1188
|
if (this.isEntry(rawEle)) [key, value] = rawEle;
|
|
1093
1189
|
else if (this._toEntryFn) [key, value] = this._toEntryFn(rawEle);
|
|
1094
|
-
if (key !== void 0 && value !== void 0)
|
|
1190
|
+
if (key !== void 0 && value !== void 0) {
|
|
1191
|
+
const sizeBefore = this._size;
|
|
1192
|
+
this.set(key, value);
|
|
1193
|
+
results.push(sizeBefore < this._size);
|
|
1194
|
+
}
|
|
1095
1195
|
}
|
|
1096
1196
|
return results;
|
|
1097
1197
|
}
|
|
@@ -1169,13 +1269,16 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1169
1269
|
* Delete the entry at a given index.
|
|
1170
1270
|
* @remarks Time O(N), Space O(1)
|
|
1171
1271
|
* @param index - Zero-based index.
|
|
1172
|
-
* @returns
|
|
1272
|
+
* @returns The removed entry [key, value].
|
|
1273
|
+
* @throws {RangeError} If index is out of bounds.
|
|
1173
1274
|
*/
|
|
1174
1275
|
deleteAt(index) {
|
|
1175
1276
|
rangeCheck(index, 0, this._size - 1);
|
|
1176
1277
|
let node = this.head;
|
|
1177
1278
|
while (index--) node = node.next;
|
|
1178
|
-
|
|
1279
|
+
const entry = [node.key, node.value];
|
|
1280
|
+
this._deleteNode(node);
|
|
1281
|
+
return entry;
|
|
1179
1282
|
}
|
|
1180
1283
|
isEmpty() {
|
|
1181
1284
|
return this._size === 0;
|