data-structure-typed 2.5.2 → 2.6.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/.husky/pre-commit +3 -0
- package/CHANGELOG.md +3 -1
- package/MIGRATION.md +217 -0
- package/README.md +80 -8
- package/README_CN.md +569 -143
- package/SPECIFICATION.md +44 -14
- package/SPECIFICATION.zh-CN.md +44 -14
- package/dist/cjs/binary-tree.cjs +5841 -1678
- package/dist/cjs/graph.cjs +422 -14
- package/dist/cjs/hash.cjs +95 -7
- package/dist/cjs/heap.cjs +174 -16
- package/dist/cjs/index.cjs +7751 -2449
- package/dist/cjs/linked-list.cjs +443 -2
- package/dist/cjs/matrix.cjs +56 -0
- package/dist/cjs/priority-queue.cjs +172 -14
- package/dist/cjs/queue.cjs +435 -0
- package/dist/cjs/stack.cjs +103 -4
- package/dist/cjs/trie.cjs +106 -0
- package/dist/cjs-legacy/binary-tree.cjs +5933 -1772
- package/dist/cjs-legacy/graph.cjs +422 -14
- package/dist/cjs-legacy/hash.cjs +95 -7
- package/dist/cjs-legacy/heap.cjs +174 -16
- package/dist/cjs-legacy/index.cjs +8154 -2854
- package/dist/cjs-legacy/linked-list.cjs +443 -2
- package/dist/cjs-legacy/matrix.cjs +56 -0
- package/dist/cjs-legacy/priority-queue.cjs +172 -14
- package/dist/cjs-legacy/queue.cjs +435 -0
- package/dist/cjs-legacy/stack.cjs +103 -4
- package/dist/cjs-legacy/trie.cjs +106 -0
- package/dist/esm/binary-tree.mjs +5841 -1678
- package/dist/esm/graph.mjs +422 -14
- package/dist/esm/hash.mjs +95 -7
- package/dist/esm/heap.mjs +174 -16
- package/dist/esm/index.mjs +7751 -2449
- package/dist/esm/linked-list.mjs +443 -2
- package/dist/esm/matrix.mjs +56 -0
- package/dist/esm/priority-queue.mjs +172 -14
- package/dist/esm/queue.mjs +435 -0
- package/dist/esm/stack.mjs +103 -4
- package/dist/esm/trie.mjs +106 -0
- package/dist/esm-legacy/binary-tree.mjs +5933 -1772
- package/dist/esm-legacy/graph.mjs +422 -14
- package/dist/esm-legacy/hash.mjs +95 -7
- package/dist/esm-legacy/heap.mjs +174 -16
- package/dist/esm-legacy/index.mjs +8154 -2854
- package/dist/esm-legacy/linked-list.mjs +443 -2
- package/dist/esm-legacy/matrix.mjs +56 -0
- package/dist/esm-legacy/priority-queue.mjs +172 -14
- package/dist/esm-legacy/queue.mjs +435 -0
- package/dist/esm-legacy/stack.mjs +103 -4
- package/dist/esm-legacy/trie.mjs +106 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +150 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +171 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +7784 -2484
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
- package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
- 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 +143 -155
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
- 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 +38 -38
- 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 +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +46 -42
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
- 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 +111 -59
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
- package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
- package/docs-site-docusaurus/docs/guide/faq.md +53 -0
- package/docs-site-docusaurus/docs/guide/guides.md +8 -9
- package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
- package/docs-site-docusaurus/docs/guide/overview.md +131 -17
- package/docs-site-docusaurus/src/pages/index.tsx +4 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/jest.integration.config.js +1 -2
- package/package.json +10 -7
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- 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 +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -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 +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
- 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
|
@@ -213,16 +213,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
|
|
216
|
-
* @example
|
|
217
|
-
* // Check empty
|
|
218
|
-
* console.log(new TreeMap().isEmpty()); // true;
|
|
219
|
-
*/
|
|
220
|
-
isEmpty(): boolean;
|
|
221
|
-
/**
|
|
222
|
-
* Set or overwrite a value for a key.
|
|
223
|
-
* @remarks Expected time O(log n)
|
|
224
|
-
|
|
225
|
-
|
|
226
216
|
|
|
227
217
|
|
|
228
218
|
|
|
@@ -258,6 +248,14 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
258
248
|
|
|
259
249
|
|
|
260
250
|
|
|
251
|
+
* @example
|
|
252
|
+
* // Check empty
|
|
253
|
+
* console.log(new TreeMap().isEmpty()); // true;
|
|
254
|
+
*/
|
|
255
|
+
isEmpty(): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Set or overwrite a value for a key.
|
|
258
|
+
* @remarks Expected time O(log n)
|
|
261
259
|
|
|
262
260
|
|
|
263
261
|
|
|
@@ -388,31 +386,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
388
386
|
|
|
389
387
|
|
|
390
388
|
|
|
391
|
-
* @example
|
|
392
|
-
* // Sorted dictionary for a contact book
|
|
393
|
-
* const contacts = new TreeMap<string, string>([
|
|
394
|
-
* ['Bob', '555-0102'],
|
|
395
|
-
* ['Alice', '555-0101'],
|
|
396
|
-
* ['Charlie', '555-0103']
|
|
397
|
-
* ]);
|
|
398
|
-
*
|
|
399
|
-
* // Contacts are automatically sorted by name
|
|
400
|
-
* console.log([...contacts.keys()]); // ['Alice', 'Bob', 'Charlie'];
|
|
401
|
-
* console.log(contacts.get('Bob')); // '555-0102';
|
|
402
|
-
*
|
|
403
|
-
* // Find the first contact alphabetically after 'B'
|
|
404
|
-
* console.log(contacts.ceiling('B')); // ['Bob', '555-0102'];
|
|
405
|
-
*
|
|
406
|
-
* // Find contacts in range
|
|
407
|
-
* console.log(contacts.rangeSearch(['Alice', 'Bob'])); // [
|
|
408
|
-
* // ['Alice', '555-0101'],
|
|
409
|
-
* // ['Bob', '555-0102']
|
|
410
|
-
* // ];
|
|
411
|
-
*/
|
|
412
|
-
set(key: K, value: V | undefined): this;
|
|
413
|
-
/**
|
|
414
|
-
* Get the value under a key.
|
|
415
|
-
* @remarks Expected time O(log n)
|
|
416
389
|
|
|
417
390
|
|
|
418
391
|
|
|
@@ -485,6 +458,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
485
458
|
|
|
486
459
|
|
|
487
460
|
|
|
461
|
+
* @example
|
|
462
|
+
* // Sorted dictionary for a contact book
|
|
463
|
+
* const contacts = new TreeMap<string, string>([
|
|
464
|
+
* ['Bob', '555-0102'],
|
|
465
|
+
* ['Alice', '555-0101'],
|
|
466
|
+
* ['Charlie', '555-0103']
|
|
467
|
+
* ]);
|
|
468
|
+
*
|
|
469
|
+
* // Contacts are automatically sorted by name
|
|
470
|
+
* console.log([...contacts.keys()]); // ['Alice', 'Bob', 'Charlie'];
|
|
471
|
+
* console.log(contacts.get('Bob')); // '555-0102';
|
|
472
|
+
*
|
|
473
|
+
* // Find the first contact alphabetically after 'B'
|
|
474
|
+
* console.log(contacts.ceiling('B')); // ['Bob', '555-0102'];
|
|
475
|
+
*
|
|
476
|
+
* // Find contacts in range
|
|
477
|
+
* console.log(contacts.rangeSearch(['Alice', 'Bob'])); // [
|
|
478
|
+
* // ['Alice', '555-0101'],
|
|
479
|
+
* // ['Bob', '555-0102']
|
|
480
|
+
* // ];
|
|
481
|
+
*/
|
|
482
|
+
set(key: K, value: V | undefined): this;
|
|
483
|
+
/**
|
|
484
|
+
* Set multiple key-value pairs at once.
|
|
485
|
+
* @remarks Expected time O(m log n), where m is the number of entries.
|
|
486
|
+
* @param entries - Iterable of `[key, value]` tuples.
|
|
487
|
+
* @returns Array of booleans indicating whether each entry was successfully set.
|
|
488
|
+
|
|
488
489
|
|
|
489
490
|
|
|
490
491
|
|
|
@@ -512,6 +513,16 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
512
513
|
|
|
513
514
|
|
|
514
515
|
|
|
516
|
+
* @example
|
|
517
|
+
* // Set multiple key-value pairs
|
|
518
|
+
* const tm = new TreeMap<number, string>();
|
|
519
|
+
* tm.setMany([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
520
|
+
* console.log(tm.size); // 3;
|
|
521
|
+
*/
|
|
522
|
+
setMany(entries: Iterable<[K, V | undefined]>): boolean[];
|
|
523
|
+
/**
|
|
524
|
+
* Get the value under a key.
|
|
525
|
+
* @remarks Expected time O(log n)
|
|
515
526
|
|
|
516
527
|
|
|
517
528
|
|
|
@@ -582,22 +593,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
582
593
|
|
|
583
594
|
|
|
584
595
|
|
|
585
|
-
* @example
|
|
586
|
-
* // Configuration registry with typed lookups
|
|
587
|
-
* const config = new TreeMap<string, number>([
|
|
588
|
-
* ['maxRetries', 3],
|
|
589
|
-
* ['timeout', 5000],
|
|
590
|
-
* ['poolSize', 10]
|
|
591
|
-
* ]);
|
|
592
|
-
*
|
|
593
|
-
* console.log(config.get('timeout')); // 5000;
|
|
594
|
-
* console.log(config.get('missing')); // undefined;
|
|
595
|
-
* console.log(config.size); // 3;
|
|
596
|
-
*/
|
|
597
|
-
get(key: K): V | undefined;
|
|
598
|
-
/**
|
|
599
|
-
* Test whether a key exists.
|
|
600
|
-
* @remarks Expected time O(log n)
|
|
601
596
|
|
|
602
597
|
|
|
603
598
|
|
|
@@ -732,6 +727,22 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
732
727
|
|
|
733
728
|
|
|
734
729
|
|
|
730
|
+
* @example
|
|
731
|
+
* // Configuration registry with typed lookups
|
|
732
|
+
* const config = new TreeMap<string, number>([
|
|
733
|
+
* ['maxRetries', 3],
|
|
734
|
+
* ['timeout', 5000],
|
|
735
|
+
* ['poolSize', 10]
|
|
736
|
+
* ]);
|
|
737
|
+
*
|
|
738
|
+
* console.log(config.get('timeout')); // 5000;
|
|
739
|
+
* console.log(config.get('missing')); // undefined;
|
|
740
|
+
* console.log(config.size); // 3;
|
|
741
|
+
*/
|
|
742
|
+
get(key: K): V | undefined;
|
|
743
|
+
/**
|
|
744
|
+
* Test whether a key exists.
|
|
745
|
+
* @remarks Expected time O(log n)
|
|
735
746
|
|
|
736
747
|
|
|
737
748
|
|
|
@@ -767,22 +778,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
767
778
|
|
|
768
779
|
|
|
769
780
|
|
|
770
|
-
* @example
|
|
771
|
-
* // Feature flag checking
|
|
772
|
-
* const flags = new TreeMap<string, boolean>([
|
|
773
|
-
* ['darkMode', true],
|
|
774
|
-
* ['betaFeature', false],
|
|
775
|
-
* ['notifications', true]
|
|
776
|
-
* ]);
|
|
777
|
-
*
|
|
778
|
-
* console.log(flags.has('darkMode')); // true;
|
|
779
|
-
* console.log(flags.has('unknownFlag')); // false;
|
|
780
|
-
*/
|
|
781
|
-
has(key: K): boolean;
|
|
782
|
-
/**
|
|
783
|
-
* Delete a key.
|
|
784
|
-
* @returns `true` if the key existed; otherwise `false`.
|
|
785
|
-
* @remarks Expected time O(log n)
|
|
786
781
|
|
|
787
782
|
|
|
788
783
|
|
|
@@ -953,28 +948,21 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
953
948
|
|
|
954
949
|
|
|
955
950
|
* @example
|
|
956
|
-
* //
|
|
957
|
-
* const
|
|
958
|
-
* ['
|
|
959
|
-
* ['
|
|
960
|
-
* ['
|
|
951
|
+
* // Feature flag checking
|
|
952
|
+
* const flags = new TreeMap<string, boolean>([
|
|
953
|
+
* ['darkMode', true],
|
|
954
|
+
* ['betaFeature', false],
|
|
955
|
+
* ['notifications', true]
|
|
961
956
|
* ]);
|
|
962
957
|
*
|
|
963
|
-
* console.log(
|
|
964
|
-
*
|
|
965
|
-
* console.log(sessions.has('sess_def')); // false;
|
|
966
|
-
* console.log(sessions.size); // 2;
|
|
958
|
+
* console.log(flags.has('darkMode')); // true;
|
|
959
|
+
* console.log(flags.has('unknownFlag')); // false;
|
|
967
960
|
*/
|
|
968
|
-
|
|
961
|
+
has(key: K): boolean;
|
|
969
962
|
/**
|
|
970
|
-
*
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
963
|
+
* Delete a key.
|
|
964
|
+
* @returns `true` if the key existed; otherwise `false`.
|
|
965
|
+
* @remarks Expected time O(log n)
|
|
978
966
|
|
|
979
967
|
|
|
980
968
|
|
|
@@ -1126,15 +1114,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1126
1114
|
|
|
1127
1115
|
|
|
1128
1116
|
|
|
1129
|
-
* @example
|
|
1130
|
-
* // Remove all
|
|
1131
|
-
* const tm = new TreeMap<number, string>([[1, 'a']]);
|
|
1132
|
-
* tm.clear();
|
|
1133
|
-
* console.log(tm.isEmpty()); // true;
|
|
1134
|
-
*/
|
|
1135
|
-
clear(): void;
|
|
1136
|
-
/**
|
|
1137
|
-
* Iterate over keys in ascending order.
|
|
1138
1117
|
|
|
1139
1118
|
|
|
1140
1119
|
|
|
@@ -1188,6 +1167,29 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1188
1167
|
|
|
1189
1168
|
|
|
1190
1169
|
|
|
1170
|
+
* @example
|
|
1171
|
+
* // Session management with expiry
|
|
1172
|
+
* const sessions = new TreeMap<string, number>([
|
|
1173
|
+
* ['sess_abc', Date.now()],
|
|
1174
|
+
* ['sess_def', Date.now()],
|
|
1175
|
+
* ['sess_ghi', Date.now()]
|
|
1176
|
+
* ]);
|
|
1177
|
+
*
|
|
1178
|
+
* console.log(sessions.size); // 3;
|
|
1179
|
+
* sessions.delete('sess_def');
|
|
1180
|
+
* console.log(sessions.has('sess_def')); // false;
|
|
1181
|
+
* console.log(sessions.size); // 2;
|
|
1182
|
+
*/
|
|
1183
|
+
delete(key: K): boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Delete all entries matching a predicate.
|
|
1186
|
+
* @remarks Time O(N), Space O(N)
|
|
1187
|
+
* @param predicate - Function (key, value, index, map) → boolean; return true to delete.
|
|
1188
|
+
* @returns True if at least one entry was deleted.
|
|
1189
|
+
*/
|
|
1190
|
+
deleteWhere(predicate: (key: K, value: V | undefined, index: number, map: this) => boolean): boolean;
|
|
1191
|
+
/**
|
|
1192
|
+
* Remove all entries.
|
|
1191
1193
|
|
|
1192
1194
|
|
|
1193
1195
|
|
|
@@ -1293,17 +1295,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1293
1295
|
|
|
1294
1296
|
|
|
1295
1297
|
|
|
1296
|
-
* @example
|
|
1297
|
-
* // Get sorted keys
|
|
1298
|
-
* const tm = new TreeMap<number, string>([[3, 'c'], [1, 'a']]);
|
|
1299
|
-
* console.log([...tm.keys()]); // [1, 3];
|
|
1300
|
-
*/
|
|
1301
|
-
keys(): IterableIterator<K>;
|
|
1302
|
-
private _entryFromKey;
|
|
1303
|
-
/**
|
|
1304
|
-
* Iterate over values in ascending key order.
|
|
1305
|
-
*
|
|
1306
|
-
* Note: values may be `undefined` (TreeMap allows storing `undefined`, like native `Map`).
|
|
1307
1298
|
|
|
1308
1299
|
|
|
1309
1300
|
|
|
@@ -1392,6 +1383,15 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1392
1383
|
|
|
1393
1384
|
|
|
1394
1385
|
|
|
1386
|
+
* @example
|
|
1387
|
+
* // Remove all
|
|
1388
|
+
* const tm = new TreeMap<number, string>([[1, 'a']]);
|
|
1389
|
+
* tm.clear();
|
|
1390
|
+
* console.log(tm.isEmpty()); // true;
|
|
1391
|
+
*/
|
|
1392
|
+
clear(): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* Iterate over keys in ascending order.
|
|
1395
1395
|
|
|
1396
1396
|
|
|
1397
1397
|
|
|
@@ -1462,16 +1462,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1462
1462
|
|
|
1463
1463
|
|
|
1464
1464
|
|
|
1465
|
-
* @example
|
|
1466
|
-
* // Get values in key order
|
|
1467
|
-
* const tm = new TreeMap<number, string>([[2, 'b'], [1, 'a']]);
|
|
1468
|
-
* console.log([...tm.values()]); // ['a', 'b'];
|
|
1469
|
-
*/
|
|
1470
|
-
values(): IterableIterator<V | undefined>;
|
|
1471
|
-
/**
|
|
1472
|
-
* Iterate over `[key, value]` entries in ascending key order.
|
|
1473
|
-
*
|
|
1474
|
-
* Note: values may be `undefined`.
|
|
1475
1465
|
|
|
1476
1466
|
|
|
1477
1467
|
|
|
@@ -1595,6 +1585,17 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1595
1585
|
|
|
1596
1586
|
|
|
1597
1587
|
|
|
1588
|
+
* @example
|
|
1589
|
+
* // Get sorted keys
|
|
1590
|
+
* const tm = new TreeMap<number, string>([[3, 'c'], [1, 'a']]);
|
|
1591
|
+
* console.log([...tm.keys()]); // [1, 3];
|
|
1592
|
+
*/
|
|
1593
|
+
keys(): IterableIterator<K>;
|
|
1594
|
+
private _entryFromKey;
|
|
1595
|
+
/**
|
|
1596
|
+
* Iterate over values in ascending key order.
|
|
1597
|
+
*
|
|
1598
|
+
* Note: values may be `undefined` (TreeMap allows storing `undefined`, like native `Map`).
|
|
1598
1599
|
|
|
1599
1600
|
|
|
1600
1601
|
|
|
@@ -1630,17 +1631,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1630
1631
|
|
|
1631
1632
|
|
|
1632
1633
|
|
|
1633
|
-
* @example
|
|
1634
|
-
* // Iterate key-value pairs
|
|
1635
|
-
* const tm = new TreeMap<number, string>([[3, 'c'], [1, 'a'], [2, 'b']]);
|
|
1636
|
-
* console.log([...tm.entries()]); // [[1, 'a'], [2, 'b'], [3, 'c']];
|
|
1637
|
-
*/
|
|
1638
|
-
entries(): IterableIterator<[K, V | undefined]>;
|
|
1639
|
-
[Symbol.iterator](): IterableIterator<[K, V | undefined]>;
|
|
1640
|
-
/**
|
|
1641
|
-
* Visit each entry in ascending key order.
|
|
1642
|
-
*
|
|
1643
|
-
* Note: callback value may be `undefined`.
|
|
1644
1634
|
|
|
1645
1635
|
|
|
1646
1636
|
|
|
@@ -1800,19 +1790,15 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1800
1790
|
|
|
1801
1791
|
|
|
1802
1792
|
* @example
|
|
1803
|
-
* //
|
|
1804
|
-
* const tm = new TreeMap<number, string>([[
|
|
1805
|
-
*
|
|
1806
|
-
* tm.forEach((v, k) => pairs.push(`${k}:${v}`));
|
|
1807
|
-
* console.log(pairs); // ['1:a', '2:b'];
|
|
1793
|
+
* // Get values in key order
|
|
1794
|
+
* const tm = new TreeMap<number, string>([[2, 'b'], [1, 'a']]);
|
|
1795
|
+
* console.log([...tm.values()]); // ['a', 'b'];
|
|
1808
1796
|
*/
|
|
1809
|
-
|
|
1797
|
+
values(): IterableIterator<V | undefined>;
|
|
1810
1798
|
/**
|
|
1811
|
-
*
|
|
1799
|
+
* Iterate over `[key, value]` entries in ascending key order.
|
|
1812
1800
|
*
|
|
1813
|
-
*
|
|
1814
|
-
* @remarks Time O(n log n) expected, Space O(n)
|
|
1815
|
-
|
|
1801
|
+
* Note: values may be `undefined`.
|
|
1816
1802
|
|
|
1817
1803
|
|
|
1818
1804
|
|
|
@@ -1970,18 +1956,499 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
1970
1956
|
|
|
1971
1957
|
|
|
1972
1958
|
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
* @example
|
|
1996
|
+
* // Iterate key-value pairs
|
|
1997
|
+
* const tm = new TreeMap<number, string>([[3, 'c'], [1, 'a'], [2, 'b']]);
|
|
1998
|
+
* console.log([...tm.entries()]); // [[1, 'a'], [2, 'b'], [3, 'c']];
|
|
1999
|
+
*/
|
|
2000
|
+
entries(): IterableIterator<[K, V | undefined]>;
|
|
2001
|
+
[Symbol.iterator](): IterableIterator<[K, V | undefined]>;
|
|
2002
|
+
/**
|
|
2003
|
+
* Visit each entry in ascending key order.
|
|
2004
|
+
*
|
|
2005
|
+
* Note: callback value may be `undefined`.
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
|
|
2061
|
+
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
|
|
2161
|
+
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
|
|
2195
|
+
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
* @example
|
|
2200
|
+
* // Execute for each entry
|
|
2201
|
+
* const tm = new TreeMap<number, string>([[1, 'a'], [2, 'b']]);
|
|
2202
|
+
* const pairs: string[] = [];
|
|
2203
|
+
* tm.forEach((v, k) => pairs.push(`${k}:${v}`));
|
|
2204
|
+
* console.log(pairs); // ['1:a', '2:b'];
|
|
2205
|
+
*/
|
|
2206
|
+
forEach(cb: (value: V | undefined, key: K, map: TreeMap<K, V>) => void, thisArg?: unknown): void;
|
|
2207
|
+
/**
|
|
2208
|
+
* Create a new TreeMap by mapping each entry to a new `[key, value]` entry.
|
|
2209
|
+
*
|
|
2210
|
+
* This mirrors `RedBlackTree.map`: mapping produces a new ordered container.
|
|
2211
|
+
* @remarks Time O(n log n) expected, Space O(n)
|
|
2212
|
+
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
|
|
2391
|
+
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
* @example
|
|
2406
|
+
* // Transform entries
|
|
2407
|
+
* const tm = new TreeMap<number, number>([[1, 10], [2, 20]]);
|
|
2408
|
+
* const doubled = tm.map((v, k) => [k, (v ?? 0) * 2] as [number, number]);
|
|
2409
|
+
* console.log([...doubled.values()]); // [20, 40];
|
|
2410
|
+
*/
|
|
2411
|
+
map<MK, MV>(callbackfn: TreeMapEntryCallback<K, V, [MK, MV], TreeMap<K, V>>, options?: Omit<TreeMapOptions<MK, MV>, 'toEntryFn'> & {
|
|
2412
|
+
comparator?: (a: MK, b: MK) => number;
|
|
2413
|
+
}, thisArg?: unknown): TreeMap<MK, MV>;
|
|
2414
|
+
/**
|
|
2415
|
+
* Create a new TreeMap containing only entries that satisfy the predicate.
|
|
2416
|
+
* @remarks Time O(n log n) expected, Space O(n)
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
1985
2452
|
|
|
1986
2453
|
|
|
1987
2454
|
|
|
@@ -2287,6 +2754,41 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2287
2754
|
|
|
2288
2755
|
|
|
2289
2756
|
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
|
|
2764
|
+
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
|
|
2791
|
+
|
|
2290
2792
|
|
|
2291
2793
|
|
|
2292
2794
|
|
|
@@ -2452,6 +2954,41 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2452
2954
|
|
|
2453
2955
|
|
|
2454
2956
|
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
|
|
2960
|
+
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
|
+
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2455
2992
|
|
|
2456
2993
|
|
|
2457
2994
|
|
|
@@ -2617,6 +3154,41 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2617
3154
|
|
|
2618
3155
|
|
|
2619
3156
|
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
|
|
3160
|
+
|
|
3161
|
+
|
|
3162
|
+
|
|
3163
|
+
|
|
3164
|
+
|
|
3165
|
+
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
|
|
3169
|
+
|
|
3170
|
+
|
|
3171
|
+
|
|
3172
|
+
|
|
3173
|
+
|
|
3174
|
+
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
|
|
2620
3192
|
|
|
2621
3193
|
|
|
2622
3194
|
|
|
@@ -2804,15 +3376,117 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2804
3376
|
|
|
2805
3377
|
|
|
2806
3378
|
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
3379
|
+
|
|
3380
|
+
|
|
3381
|
+
|
|
3382
|
+
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
|
|
3387
|
+
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
|
|
3409
|
+
|
|
3410
|
+
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
* @example
|
|
3415
|
+
* // Find matching entry
|
|
3416
|
+
* const tm = new TreeMap<number, string>([[1, 'a'], [2, 'b']]);
|
|
3417
|
+
* console.log(tm.find(v => v === 'b')?.[0]); // 2;
|
|
3418
|
+
*/
|
|
3419
|
+
find(callbackfn: TreeMapEntryCallback<K, V, boolean, TreeMap<K, V>>, thisArg?: unknown): [K, V | undefined] | undefined;
|
|
3420
|
+
/**
|
|
3421
|
+
* Materialize the map into an array of `[key, value]` tuples.
|
|
3422
|
+
* @remarks Time O(n), Space O(n)
|
|
3423
|
+
|
|
3424
|
+
|
|
3425
|
+
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
|
|
3432
|
+
|
|
3433
|
+
|
|
3434
|
+
|
|
3435
|
+
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
|
|
3439
|
+
|
|
3440
|
+
|
|
3441
|
+
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
|
|
3445
|
+
|
|
3446
|
+
|
|
3447
|
+
|
|
3448
|
+
|
|
3449
|
+
|
|
3450
|
+
|
|
3451
|
+
|
|
3452
|
+
|
|
3453
|
+
|
|
3454
|
+
|
|
3455
|
+
|
|
3456
|
+
|
|
3457
|
+
|
|
3458
|
+
|
|
3459
|
+
|
|
3460
|
+
|
|
3461
|
+
|
|
3462
|
+
|
|
3463
|
+
|
|
3464
|
+
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
|
|
3468
|
+
|
|
3469
|
+
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
|
|
3484
|
+
|
|
3485
|
+
|
|
3486
|
+
|
|
3487
|
+
|
|
3488
|
+
|
|
3489
|
+
|
|
2816
3490
|
|
|
2817
3491
|
|
|
2818
3492
|
|
|
@@ -2939,6 +3613,18 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2939
3613
|
|
|
2940
3614
|
|
|
2941
3615
|
|
|
3616
|
+
* @example
|
|
3617
|
+
* // Convert to array
|
|
3618
|
+
* const tm = new TreeMap<number, string>([[2, 'b'], [1, 'a']]);
|
|
3619
|
+
* console.log(tm.toArray()); // [[1, 'a'], [2, 'b']];
|
|
3620
|
+
*/
|
|
3621
|
+
toArray(): Array<[K, V | undefined]>;
|
|
3622
|
+
/**
|
|
3623
|
+
* Print a human-friendly representation.
|
|
3624
|
+
* @remarks Time O(n), Space O(n)
|
|
3625
|
+
|
|
3626
|
+
|
|
3627
|
+
|
|
2942
3628
|
|
|
2943
3629
|
|
|
2944
3630
|
|
|
@@ -2971,15 +3657,6 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
2971
3657
|
|
|
2972
3658
|
|
|
2973
3659
|
|
|
2974
|
-
* @example
|
|
2975
|
-
* // Convert to array
|
|
2976
|
-
* const tm = new TreeMap<number, string>([[2, 'b'], [1, 'a']]);
|
|
2977
|
-
* console.log(tm.toArray()); // [[1, 'a'], [2, 'b']];
|
|
2978
|
-
*/
|
|
2979
|
-
toArray(): Array<[K, V | undefined]>;
|
|
2980
|
-
/**
|
|
2981
|
-
* Print a human-friendly representation.
|
|
2982
|
-
* @remarks Time O(n), Space O(n)
|
|
2983
3660
|
|
|
2984
3661
|
|
|
2985
3662
|
|
|
@@ -3173,6 +3850,13 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3173
3850
|
|
|
3174
3851
|
|
|
3175
3852
|
|
|
3853
|
+
|
|
3854
|
+
|
|
3855
|
+
|
|
3856
|
+
|
|
3857
|
+
|
|
3858
|
+
|
|
3859
|
+
|
|
3176
3860
|
|
|
3177
3861
|
|
|
3178
3862
|
|
|
@@ -3238,6 +3922,13 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3238
3922
|
|
|
3239
3923
|
|
|
3240
3924
|
|
|
3925
|
+
|
|
3926
|
+
|
|
3927
|
+
|
|
3928
|
+
|
|
3929
|
+
|
|
3930
|
+
|
|
3931
|
+
|
|
3241
3932
|
|
|
3242
3933
|
|
|
3243
3934
|
|
|
@@ -3287,6 +3978,13 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3287
3978
|
|
|
3288
3979
|
|
|
3289
3980
|
|
|
3981
|
+
|
|
3982
|
+
|
|
3983
|
+
|
|
3984
|
+
|
|
3985
|
+
|
|
3986
|
+
|
|
3987
|
+
|
|
3290
3988
|
|
|
3291
3989
|
|
|
3292
3990
|
|
|
@@ -3338,6 +4036,13 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3338
4036
|
|
|
3339
4037
|
|
|
3340
4038
|
|
|
4039
|
+
|
|
4040
|
+
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
|
|
3341
4046
|
|
|
3342
4047
|
|
|
3343
4048
|
|
|
@@ -3475,6 +4180,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3475
4180
|
|
|
3476
4181
|
|
|
3477
4182
|
|
|
4183
|
+
|
|
4184
|
+
|
|
4185
|
+
|
|
4186
|
+
|
|
4187
|
+
|
|
4188
|
+
|
|
4189
|
+
|
|
4190
|
+
|
|
4191
|
+
|
|
4192
|
+
|
|
4193
|
+
|
|
4194
|
+
|
|
4195
|
+
|
|
4196
|
+
|
|
4197
|
+
|
|
4198
|
+
|
|
4199
|
+
|
|
4200
|
+
|
|
4201
|
+
|
|
4202
|
+
|
|
4203
|
+
|
|
4204
|
+
|
|
4205
|
+
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
|
|
3478
4211
|
|
|
3479
4212
|
|
|
3480
4213
|
|
|
@@ -3644,6 +4377,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3644
4377
|
|
|
3645
4378
|
|
|
3646
4379
|
|
|
4380
|
+
|
|
4381
|
+
|
|
4382
|
+
|
|
4383
|
+
|
|
4384
|
+
|
|
4385
|
+
|
|
4386
|
+
|
|
4387
|
+
|
|
4388
|
+
|
|
4389
|
+
|
|
4390
|
+
|
|
4391
|
+
|
|
4392
|
+
|
|
4393
|
+
|
|
4394
|
+
|
|
4395
|
+
|
|
4396
|
+
|
|
4397
|
+
|
|
4398
|
+
|
|
4399
|
+
|
|
4400
|
+
|
|
4401
|
+
|
|
4402
|
+
|
|
4403
|
+
|
|
4404
|
+
|
|
4405
|
+
|
|
4406
|
+
|
|
4407
|
+
|
|
3647
4408
|
|
|
3648
4409
|
|
|
3649
4410
|
|
|
@@ -3797,6 +4558,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3797
4558
|
|
|
3798
4559
|
|
|
3799
4560
|
|
|
4561
|
+
|
|
4562
|
+
|
|
4563
|
+
|
|
4564
|
+
|
|
4565
|
+
|
|
4566
|
+
|
|
4567
|
+
|
|
4568
|
+
|
|
4569
|
+
|
|
4570
|
+
|
|
4571
|
+
|
|
4572
|
+
|
|
4573
|
+
|
|
4574
|
+
|
|
4575
|
+
|
|
4576
|
+
|
|
4577
|
+
|
|
4578
|
+
|
|
4579
|
+
|
|
4580
|
+
|
|
4581
|
+
|
|
4582
|
+
|
|
4583
|
+
|
|
4584
|
+
|
|
4585
|
+
|
|
4586
|
+
|
|
4587
|
+
|
|
4588
|
+
|
|
3800
4589
|
|
|
3801
4590
|
|
|
3802
4591
|
|
|
@@ -3950,6 +4739,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
3950
4739
|
|
|
3951
4740
|
|
|
3952
4741
|
|
|
4742
|
+
|
|
4743
|
+
|
|
4744
|
+
|
|
4745
|
+
|
|
4746
|
+
|
|
4747
|
+
|
|
4748
|
+
|
|
4749
|
+
|
|
4750
|
+
|
|
4751
|
+
|
|
4752
|
+
|
|
4753
|
+
|
|
4754
|
+
|
|
4755
|
+
|
|
4756
|
+
|
|
4757
|
+
|
|
4758
|
+
|
|
4759
|
+
|
|
4760
|
+
|
|
4761
|
+
|
|
4762
|
+
|
|
4763
|
+
|
|
4764
|
+
|
|
4765
|
+
|
|
4766
|
+
|
|
4767
|
+
|
|
4768
|
+
|
|
4769
|
+
|
|
3953
4770
|
|
|
3954
4771
|
|
|
3955
4772
|
|
|
@@ -4104,6 +4921,34 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
4104
4921
|
|
|
4105
4922
|
|
|
4106
4923
|
|
|
4924
|
+
|
|
4925
|
+
|
|
4926
|
+
|
|
4927
|
+
|
|
4928
|
+
|
|
4929
|
+
|
|
4930
|
+
|
|
4931
|
+
|
|
4932
|
+
|
|
4933
|
+
|
|
4934
|
+
|
|
4935
|
+
|
|
4936
|
+
|
|
4937
|
+
|
|
4938
|
+
|
|
4939
|
+
|
|
4940
|
+
|
|
4941
|
+
|
|
4942
|
+
|
|
4943
|
+
|
|
4944
|
+
|
|
4945
|
+
|
|
4946
|
+
|
|
4947
|
+
|
|
4948
|
+
|
|
4949
|
+
|
|
4950
|
+
|
|
4951
|
+
|
|
4107
4952
|
|
|
4108
4953
|
|
|
4109
4954
|
|
|
@@ -4193,8 +5038,22 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
4193
5038
|
* Returns keys by rank range (0-indexed, inclusive on both ends).
|
|
4194
5039
|
* @remarks Time O(log n + k). Requires `enableOrderStatistic: true`.
|
|
4195
5040
|
|
|
5041
|
+
|
|
5042
|
+
|
|
5043
|
+
|
|
5044
|
+
|
|
5045
|
+
|
|
5046
|
+
|
|
5047
|
+
|
|
5048
|
+
|
|
5049
|
+
|
|
5050
|
+
|
|
5051
|
+
|
|
5052
|
+
|
|
5053
|
+
|
|
5054
|
+
|
|
4196
5055
|
* @example
|
|
4197
|
-
* // Pagination
|
|
5056
|
+
* // Pagination by position in tree order
|
|
4198
5057
|
* const tree = new TreeMap<number>(
|
|
4199
5058
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
4200
5059
|
* { enableOrderStatistic: true }
|
|
@@ -4350,6 +5209,41 @@ export declare class TreeMap<K = any, V = any, R = [K, V]> implements Iterable<[
|
|
|
4350
5209
|
|
|
4351
5210
|
|
|
4352
5211
|
|
|
5212
|
+
|
|
5213
|
+
|
|
5214
|
+
|
|
5215
|
+
|
|
5216
|
+
|
|
5217
|
+
|
|
5218
|
+
|
|
5219
|
+
|
|
5220
|
+
|
|
5221
|
+
|
|
5222
|
+
|
|
5223
|
+
|
|
5224
|
+
|
|
5225
|
+
|
|
5226
|
+
|
|
5227
|
+
|
|
5228
|
+
|
|
5229
|
+
|
|
5230
|
+
|
|
5231
|
+
|
|
5232
|
+
|
|
5233
|
+
|
|
5234
|
+
|
|
5235
|
+
|
|
5236
|
+
|
|
5237
|
+
|
|
5238
|
+
|
|
5239
|
+
|
|
5240
|
+
|
|
5241
|
+
|
|
5242
|
+
|
|
5243
|
+
|
|
5244
|
+
|
|
5245
|
+
|
|
5246
|
+
|
|
4353
5247
|
|
|
4354
5248
|
|
|
4355
5249
|
|