data-structure-typed 2.1.0 → 2.1.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.
- package/CHANGELOG.md +5 -1
- package/COMMANDS.md +13 -3
- package/README.md +5 -34
- package/benchmark/report.html +1 -1
- package/benchmark/report.json +101 -101
- package/dist/cjs/index.cjs +13062 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.mjs +12984 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.cjs +13091 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +13013 -0
- package/dist/index.js.map +1 -0
- package/dist/{cjs → types}/data-structures/binary-tree/avl-tree-counter.d.ts +4 -4
- package/dist/{esm → types}/data-structures/binary-tree/avl-tree-multi-map.d.ts +5 -5
- package/dist/{esm → types}/data-structures/binary-tree/avl-tree.d.ts +4 -4
- package/dist/{esm → types}/data-structures/binary-tree/binary-tree.d.ts +5 -5
- package/dist/{esm → types}/data-structures/binary-tree/bst.d.ts +5 -5
- package/dist/{esm → types}/data-structures/binary-tree/red-black-tree.d.ts +5 -5
- package/dist/{cjs → types}/data-structures/binary-tree/tree-counter.d.ts +4 -4
- package/dist/{cjs → types}/data-structures/binary-tree/tree-multi-map.d.ts +5 -5
- package/dist/{esm → types}/interfaces/binary-tree.d.ts +2 -2
- package/dist/umd/data-structure-typed.js +12 -11
- package/dist/umd/data-structure-typed.js.map +1 -0
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/jest.integration.config.js +3 -0
- package/package.json +13 -11
- package/src/data-structures/binary-tree/avl-tree-counter.ts +4 -7
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +5 -10
- package/src/data-structures/binary-tree/avl-tree.ts +4 -6
- package/src/data-structures/binary-tree/binary-tree.ts +14 -16
- package/src/data-structures/binary-tree/bst.ts +5 -10
- package/src/data-structures/binary-tree/red-black-tree.ts +5 -10
- package/src/data-structures/binary-tree/tree-counter.ts +4 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +5 -10
- package/src/interfaces/binary-tree.ts +2 -2
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/performance/data-structures/comparison/comparison.test.ts +27 -57
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +109 -1
- package/tsconfig-base.json +20 -20
- package/tsconfig-types.json +17 -0
- package/tsconfig.test.json +8 -0
- package/tsup.config.js +11 -22
- package/tsup.node.config.ts +37 -0
- package/dist/cjs/common/index.js +0 -29
- package/dist/cjs/common/index.js.map +0 -1
- package/dist/cjs/data-structures/base/index.js +0 -19
- package/dist/cjs/data-structures/base/index.js.map +0 -1
- package/dist/cjs/data-structures/base/iterable-element-base.js +0 -244
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +0 -1
- package/dist/cjs/data-structures/base/iterable-entry-base.js +0 -184
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +0 -1
- package/dist/cjs/data-structures/base/linear-base.js +0 -416
- package/dist/cjs/data-structures/base/linear-base.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +0 -375
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -135
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +0 -251
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -291
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -612
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +0 -295
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +0 -754
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +0 -1926
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +0 -413
- package/dist/cjs/data-structures/binary-tree/bst.js +0 -904
- package/dist/cjs/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/index.js +0 -27
- package/dist/cjs/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +0 -208
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js +0 -547
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/segment-tree.js +0 -298
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/tree-counter.js +0 -414
- package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +0 -385
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/cjs/data-structures/graph/abstract-graph.js +0 -897
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/directed-graph.js +0 -526
- package/dist/cjs/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/index.js +0 -21
- package/dist/cjs/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/data-structures/graph/map-graph.js +0 -108
- package/dist/cjs/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/undirected-graph.js +0 -425
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/data-structures/hash/hash-map.js +0 -693
- package/dist/cjs/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/data-structures/hash/index.js +0 -18
- package/dist/cjs/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/data-structures/heap/heap.js +0 -902
- package/dist/cjs/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/index.js +0 -20
- package/dist/cjs/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/data-structures/heap/max-heap.js +0 -41
- package/dist/cjs/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/min-heap.js +0 -32
- package/dist/cjs/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/data-structures/index.js +0 -29
- package/dist/cjs/data-structures/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +0 -1112
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/index.js +0 -20
- package/dist/cjs/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +0 -851
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +0 -145
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/matrix/index.js +0 -19
- package/dist/cjs/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/data-structures/matrix/matrix.js +0 -449
- package/dist/cjs/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/data-structures/matrix/navigator.js +0 -112
- package/dist/cjs/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/index.js +0 -20
- package/dist/cjs/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -35
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -25
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +0 -21
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/queue/deque.js +0 -880
- package/dist/cjs/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/data-structures/queue/index.js +0 -19
- package/dist/cjs/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/data-structures/queue/queue.js +0 -474
- package/dist/cjs/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/data-structures/stack/index.js +0 -18
- package/dist/cjs/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/data-structures/stack/stack.js +0 -402
- package/dist/cjs/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/data-structures/tree/index.js +0 -18
- package/dist/cjs/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/data-structures/tree/tree.js +0 -108
- package/dist/cjs/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/data-structures/trie/index.js +0 -18
- package/dist/cjs/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/data-structures/trie/trie.js +0 -611
- package/dist/cjs/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +0 -59
- package/dist/cjs/interfaces/binary-tree.js +0 -3
- package/dist/cjs/interfaces/binary-tree.js.map +0 -1
- package/dist/cjs/interfaces/doubly-linked-list.js +0 -3
- package/dist/cjs/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/cjs/interfaces/graph.js +0 -3
- package/dist/cjs/interfaces/graph.js.map +0 -1
- package/dist/cjs/interfaces/heap.js +0 -3
- package/dist/cjs/interfaces/heap.js.map +0 -1
- package/dist/cjs/interfaces/index.js +0 -25
- package/dist/cjs/interfaces/index.js.map +0 -1
- package/dist/cjs/interfaces/navigator.js +0 -3
- package/dist/cjs/interfaces/navigator.js.map +0 -1
- package/dist/cjs/interfaces/priority-queue.js +0 -3
- package/dist/cjs/interfaces/priority-queue.js.map +0 -1
- package/dist/cjs/interfaces/segment-tree.js +0 -3
- package/dist/cjs/interfaces/segment-tree.js.map +0 -1
- package/dist/cjs/interfaces/singly-linked-list.js +0 -3
- package/dist/cjs/interfaces/singly-linked-list.js.map +0 -1
- package/dist/cjs/types/common.js +0 -3
- package/dist/cjs/types/common.js.map +0 -1
- package/dist/cjs/types/data-structures/base/base.js +0 -3
- package/dist/cjs/types/data-structures/base/base.js.map +0 -1
- package/dist/cjs/types/data-structures/base/index.js +0 -18
- package/dist/cjs/types/data-structures/base/index.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/bst.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/index.js +0 -26
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/abstract-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/directed-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/index.js +0 -20
- package/dist/cjs/types/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/map-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/undirected-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/hash-map.js +0 -3
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/index.js +0 -18
- package/dist/cjs/types/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/index.js +0 -18
- package/dist/cjs/types/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/max-heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/min-heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/index.js +0 -29
- package/dist/cjs/types/data-structures/index.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/index.js +0 -20
- package/dist/cjs/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/index.js +0 -19
- package/dist/cjs/types/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix.js +0 -3
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/navigator.js +0 -3
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/index.js +0 -20
- package/dist/cjs/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/deque.js +0 -3
- package/dist/cjs/types/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/index.js +0 -19
- package/dist/cjs/types/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/queue.js +0 -3
- package/dist/cjs/types/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/index.js +0 -18
- package/dist/cjs/types/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/stack.js +0 -3
- package/dist/cjs/types/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/index.js +0 -18
- package/dist/cjs/types/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/tree.js +0 -3
- package/dist/cjs/types/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/index.js +0 -18
- package/dist/cjs/types/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/trie.js +0 -3
- package/dist/cjs/types/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/types/index.js +0 -20
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/utils/index.js +0 -19
- package/dist/cjs/types/utils/index.js.map +0 -1
- package/dist/cjs/types/utils/utils.js +0 -3
- package/dist/cjs/types/utils/utils.js.map +0 -1
- package/dist/cjs/types/utils/validate-type.js +0 -3
- package/dist/cjs/types/utils/validate-type.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -19
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/number.js +0 -24
- package/dist/cjs/utils/number.js.map +0 -1
- package/dist/cjs/utils/utils.js +0 -354
- package/dist/cjs/utils/utils.js.map +0 -1
- package/dist/esm/common/index.d.ts +0 -12
- package/dist/esm/common/index.js +0 -29
- package/dist/esm/common/index.js.map +0 -1
- package/dist/esm/data-structures/base/index.d.ts +0 -2
- package/dist/esm/data-structures/base/index.js +0 -3
- package/dist/esm/data-structures/base/index.js.map +0 -1
- package/dist/esm/data-structures/base/iterable-element-base.d.ts +0 -219
- package/dist/esm/data-structures/base/iterable-element-base.js +0 -247
- package/dist/esm/data-structures/base/iterable-element-base.js.map +0 -1
- package/dist/esm/data-structures/base/iterable-entry-base.d.ts +0 -144
- package/dist/esm/data-structures/base/iterable-entry-base.js +0 -180
- package/dist/esm/data-structures/base/iterable-entry-base.js.map +0 -1
- package/dist/esm/data-structures/base/linear-base.d.ts +0 -335
- package/dist/esm/data-structures/base/linear-base.js +0 -412
- package/dist/esm/data-structures/base/linear-base.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +0 -182
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +0 -369
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +0 -244
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree.js +0 -607
- package/dist/esm/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js +0 -296
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/binary-tree.js +0 -1922
- package/dist/esm/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/bst.js +0 -901
- package/dist/esm/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/index.d.ts +0 -10
- package/dist/esm/data-structures/binary-tree/index.js +0 -11
- package/dist/esm/data-structures/binary-tree/index.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/red-black-tree.js +0 -540
- package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/segment-tree.d.ts +0 -160
- package/dist/esm/data-structures/binary-tree/segment-tree.js +0 -295
- package/dist/esm/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +0 -190
- package/dist/esm/data-structures/binary-tree/tree-counter.js +0 -412
- package/dist/esm/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +0 -270
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js +0 -378
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/esm/data-structures/graph/abstract-graph.d.ts +0 -340
- package/dist/esm/data-structures/graph/abstract-graph.js +0 -892
- package/dist/esm/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/directed-graph.d.ts +0 -207
- package/dist/esm/data-structures/graph/directed-graph.js +0 -521
- package/dist/esm/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/index.d.ts +0 -4
- package/dist/esm/data-structures/graph/index.js +0 -5
- package/dist/esm/data-structures/graph/index.js.map +0 -1
- package/dist/esm/data-structures/graph/map-graph.d.ts +0 -78
- package/dist/esm/data-structures/graph/map-graph.js +0 -105
- package/dist/esm/data-structures/graph/map-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/undirected-graph.d.ts +0 -188
- package/dist/esm/data-structures/graph/undirected-graph.js +0 -418
- package/dist/esm/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/esm/data-structures/hash/hash-map.d.ts +0 -345
- package/dist/esm/data-structures/hash/hash-map.js +0 -691
- package/dist/esm/data-structures/hash/hash-map.js.map +0 -1
- package/dist/esm/data-structures/hash/index.d.ts +0 -1
- package/dist/esm/data-structures/hash/index.js +0 -2
- package/dist/esm/data-structures/hash/index.js.map +0 -1
- package/dist/esm/data-structures/heap/heap.d.ts +0 -503
- package/dist/esm/data-structures/heap/heap.js +0 -894
- package/dist/esm/data-structures/heap/heap.js.map +0 -1
- package/dist/esm/data-structures/heap/index.d.ts +0 -3
- package/dist/esm/data-structures/heap/index.js +0 -4
- package/dist/esm/data-structures/heap/index.js.map +0 -1
- package/dist/esm/data-structures/heap/max-heap.d.ts +0 -32
- package/dist/esm/data-structures/heap/max-heap.js +0 -40
- package/dist/esm/data-structures/heap/max-heap.js.map +0 -1
- package/dist/esm/data-structures/heap/min-heap.d.ts +0 -33
- package/dist/esm/data-structures/heap/min-heap.js +0 -28
- package/dist/esm/data-structures/heap/min-heap.js.map +0 -1
- package/dist/esm/data-structures/index.d.ts +0 -12
- package/dist/esm/data-structures/index.js +0 -13
- package/dist/esm/data-structures/index.js.map +0 -1
- package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +0 -769
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js +0 -1109
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/esm/data-structures/linked-list/index.d.ts +0 -3
- package/dist/esm/data-structures/linked-list/index.js +0 -4
- package/dist/esm/data-structures/linked-list/index.js.map +0 -1
- package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +0 -451
- package/dist/esm/data-structures/linked-list/singly-linked-list.js +0 -847
- package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/esm/data-structures/linked-list/skip-linked-list.d.ts +0 -27
- package/dist/esm/data-structures/linked-list/skip-linked-list.js +0 -143
- package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/esm/data-structures/matrix/index.d.ts +0 -2
- package/dist/esm/data-structures/matrix/index.js +0 -3
- package/dist/esm/data-structures/matrix/index.js.map +0 -1
- package/dist/esm/data-structures/matrix/matrix.d.ts +0 -168
- package/dist/esm/data-structures/matrix/matrix.js +0 -444
- package/dist/esm/data-structures/matrix/matrix.js.map +0 -1
- package/dist/esm/data-structures/matrix/navigator.d.ts +0 -55
- package/dist/esm/data-structures/matrix/navigator.js +0 -114
- package/dist/esm/data-structures/matrix/navigator.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/index.d.ts +0 -3
- package/dist/esm/data-structures/priority-queue/index.js +0 -4
- package/dist/esm/data-structures/priority-queue/index.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +0 -27
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js +0 -34
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +0 -26
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js +0 -21
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +0 -15
- package/dist/esm/data-structures/priority-queue/priority-queue.js +0 -17
- package/dist/esm/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/esm/data-structures/queue/deque.d.ts +0 -431
- package/dist/esm/data-structures/queue/deque.js +0 -880
- package/dist/esm/data-structures/queue/deque.js.map +0 -1
- package/dist/esm/data-structures/queue/index.d.ts +0 -2
- package/dist/esm/data-structures/queue/index.js +0 -3
- package/dist/esm/data-structures/queue/index.js.map +0 -1
- package/dist/esm/data-structures/queue/queue.d.ts +0 -308
- package/dist/esm/data-structures/queue/queue.js +0 -467
- package/dist/esm/data-structures/queue/queue.js.map +0 -1
- package/dist/esm/data-structures/stack/index.d.ts +0 -1
- package/dist/esm/data-structures/stack/index.js +0 -2
- package/dist/esm/data-structures/stack/index.js.map +0 -1
- package/dist/esm/data-structures/stack/stack.d.ts +0 -306
- package/dist/esm/data-structures/stack/stack.js +0 -398
- package/dist/esm/data-structures/stack/stack.js.map +0 -1
- package/dist/esm/data-structures/tree/index.d.ts +0 -1
- package/dist/esm/data-structures/tree/index.js +0 -2
- package/dist/esm/data-structures/tree/index.js.map +0 -1
- package/dist/esm/data-structures/tree/tree.d.ts +0 -62
- package/dist/esm/data-structures/tree/tree.js +0 -107
- package/dist/esm/data-structures/tree/tree.js.map +0 -1
- package/dist/esm/data-structures/trie/index.d.ts +0 -1
- package/dist/esm/data-structures/trie/index.js +0 -2
- package/dist/esm/data-structures/trie/index.js.map +0 -1
- package/dist/esm/data-structures/trie/trie.d.ts +0 -350
- package/dist/esm/data-structures/trie/trie.js +0 -613
- package/dist/esm/data-structures/trie/trie.js.map +0 -1
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/interfaces/binary-tree.js +0 -2
- package/dist/esm/interfaces/binary-tree.js.map +0 -1
- package/dist/esm/interfaces/doubly-linked-list.d.ts +0 -1
- package/dist/esm/interfaces/doubly-linked-list.js +0 -2
- package/dist/esm/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/esm/interfaces/graph.d.ts +0 -21
- package/dist/esm/interfaces/graph.js +0 -2
- package/dist/esm/interfaces/graph.js.map +0 -1
- package/dist/esm/interfaces/heap.d.ts +0 -1
- package/dist/esm/interfaces/heap.js +0 -2
- package/dist/esm/interfaces/heap.js.map +0 -1
- package/dist/esm/interfaces/index.d.ts +0 -8
- package/dist/esm/interfaces/index.js +0 -9
- package/dist/esm/interfaces/index.js.map +0 -1
- package/dist/esm/interfaces/navigator.d.ts +0 -1
- package/dist/esm/interfaces/navigator.js +0 -2
- package/dist/esm/interfaces/navigator.js.map +0 -1
- package/dist/esm/interfaces/priority-queue.d.ts +0 -1
- package/dist/esm/interfaces/priority-queue.js +0 -2
- package/dist/esm/interfaces/priority-queue.js.map +0 -1
- package/dist/esm/interfaces/segment-tree.d.ts +0 -1
- package/dist/esm/interfaces/segment-tree.js +0 -2
- package/dist/esm/interfaces/segment-tree.js.map +0 -1
- package/dist/esm/interfaces/singly-linked-list.d.ts +0 -1
- package/dist/esm/interfaces/singly-linked-list.js +0 -2
- package/dist/esm/interfaces/singly-linked-list.js.map +0 -1
- package/dist/esm/types/common.d.ts +0 -15
- package/dist/esm/types/common.js +0 -2
- package/dist/esm/types/common.js.map +0 -1
- package/dist/esm/types/data-structures/base/base.d.ts +0 -13
- package/dist/esm/types/data-structures/base/base.js +0 -2
- package/dist/esm/types/data-structures/base/base.js.map +0 -1
- package/dist/esm/types/data-structures/base/index.d.ts +0 -1
- package/dist/esm/types/data-structures/base/index.js +0 -2
- package/dist/esm/types/data-structures/base/index.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +0 -29
- package/dist/esm/types/data-structures/binary-tree/binary-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/bst.d.ts +0 -12
- package/dist/esm/types/data-structures/binary-tree/bst.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/index.d.ts +0 -9
- package/dist/esm/types/data-structures/binary-tree/index.js +0 -10
- package/dist/esm/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.d.ts +0 -3
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/segment-tree.d.ts +0 -1
- package/dist/esm/types/data-structures/binary-tree/segment-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/esm/types/data-structures/graph/abstract-graph.d.ts +0 -14
- package/dist/esm/types/data-structures/graph/abstract-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/directed-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/directed-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/index.d.ts +0 -3
- package/dist/esm/types/data-structures/graph/index.js +0 -4
- package/dist/esm/types/data-structures/graph/index.js.map +0 -1
- package/dist/esm/types/data-structures/graph/map-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/map-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/undirected-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/undirected-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/esm/types/data-structures/hash/hash-map.d.ts +0 -19
- package/dist/esm/types/data-structures/hash/hash-map.js +0 -2
- package/dist/esm/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/esm/types/data-structures/hash/index.d.ts +0 -2
- package/dist/esm/types/data-structures/hash/index.js +0 -2
- package/dist/esm/types/data-structures/hash/index.js.map +0 -1
- package/dist/esm/types/data-structures/heap/heap.d.ts +0 -5
- package/dist/esm/types/data-structures/heap/heap.js +0 -2
- package/dist/esm/types/data-structures/heap/heap.js.map +0 -1
- package/dist/esm/types/data-structures/heap/index.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/index.js +0 -2
- package/dist/esm/types/data-structures/heap/index.js.map +0 -1
- package/dist/esm/types/data-structures/heap/max-heap.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/max-heap.js +0 -2
- package/dist/esm/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/esm/types/data-structures/heap/min-heap.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/min-heap.js +0 -2
- package/dist/esm/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/esm/types/data-structures/index.d.ts +0 -12
- package/dist/esm/types/data-structures/index.js +0 -13
- package/dist/esm/types/data-structures/index.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -2
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/index.d.ts +0 -3
- package/dist/esm/types/data-structures/linked-list/index.js +0 -4
- package/dist/esm/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +0 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.d.ts +0 -4
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/index.d.ts +0 -2
- package/dist/esm/types/data-structures/matrix/index.js +0 -3
- package/dist/esm/types/data-structures/matrix/index.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/matrix.d.ts +0 -7
- package/dist/esm/types/data-structures/matrix/matrix.js +0 -2
- package/dist/esm/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/navigator.d.ts +0 -14
- package/dist/esm/types/data-structures/matrix/navigator.js +0 -2
- package/dist/esm/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/index.d.ts +0 -3
- package/dist/esm/types/data-structures/priority-queue/index.js +0 -4
- package/dist/esm/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -1
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -1
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/priority-queue.d.ts +0 -2
- package/dist/esm/types/data-structures/priority-queue/priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/queue/deque.d.ts +0 -4
- package/dist/esm/types/data-structures/queue/deque.js +0 -2
- package/dist/esm/types/data-structures/queue/deque.js.map +0 -1
- package/dist/esm/types/data-structures/queue/index.d.ts +0 -2
- package/dist/esm/types/data-structures/queue/index.js +0 -3
- package/dist/esm/types/data-structures/queue/index.js.map +0 -1
- package/dist/esm/types/data-structures/queue/queue.d.ts +0 -4
- package/dist/esm/types/data-structures/queue/queue.js +0 -2
- package/dist/esm/types/data-structures/queue/queue.js.map +0 -1
- package/dist/esm/types/data-structures/stack/index.d.ts +0 -1
- package/dist/esm/types/data-structures/stack/index.js +0 -2
- package/dist/esm/types/data-structures/stack/index.js.map +0 -1
- package/dist/esm/types/data-structures/stack/stack.d.ts +0 -2
- package/dist/esm/types/data-structures/stack/stack.js +0 -2
- package/dist/esm/types/data-structures/stack/stack.js.map +0 -1
- package/dist/esm/types/data-structures/tree/index.d.ts +0 -1
- package/dist/esm/types/data-structures/tree/index.js +0 -2
- package/dist/esm/types/data-structures/tree/index.js.map +0 -1
- package/dist/esm/types/data-structures/tree/tree.d.ts +0 -1
- package/dist/esm/types/data-structures/tree/tree.js +0 -2
- package/dist/esm/types/data-structures/tree/tree.js.map +0 -1
- package/dist/esm/types/data-structures/trie/index.d.ts +0 -1
- package/dist/esm/types/data-structures/trie/index.js +0 -2
- package/dist/esm/types/data-structures/trie/index.js.map +0 -1
- package/dist/esm/types/data-structures/trie/trie.d.ts +0 -4
- package/dist/esm/types/data-structures/trie/trie.js +0 -2
- package/dist/esm/types/data-structures/trie/trie.js.map +0 -1
- package/dist/esm/types/index.d.ts +0 -3
- package/dist/esm/types/index.js +0 -4
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/utils/index.d.ts +0 -2
- package/dist/esm/types/utils/index.js +0 -3
- package/dist/esm/types/utils/index.js.map +0 -1
- package/dist/esm/types/utils/utils.d.ts +0 -22
- package/dist/esm/types/utils/utils.js +0 -2
- package/dist/esm/types/utils/utils.js.map +0 -1
- package/dist/esm/types/utils/validate-type.d.ts +0 -19
- package/dist/esm/types/utils/validate-type.js +0 -2
- package/dist/esm/types/utils/validate-type.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -2
- package/dist/esm/utils/index.js +0 -3
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/number.d.ts +0 -14
- package/dist/esm/utils/number.js +0 -21
- package/dist/esm/utils/number.js.map +0 -1
- package/dist/esm/utils/utils.d.ts +0 -209
- package/dist/esm/utils/utils.js +0 -325
- package/dist/esm/utils/utils.js.map +0 -1
- package/tsconfig-cjs.json +0 -14
- package/tsconfig-esm.json +0 -14
- /package/dist/{cjs → types}/common/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/base/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/base/iterable-element-base.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/base/iterable-entry-base.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/base/linear-base.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/stack/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/trie/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/trie/trie.d.ts +0 -0
- /package/dist/{cjs → types}/index.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/doubly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/graph.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/heap.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/index.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/singly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/common.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/base/base.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/base/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/red-black-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-counter.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/hash/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/stack/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/trie/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/trie/trie.d.ts +0 -0
- /package/dist/{cjs → types}/types/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/utils/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/utils/utils.d.ts +0 -0
- /package/dist/{cjs → types}/types/utils/validate-type.d.ts +0 -0
- /package/dist/{cjs → types}/utils/index.d.ts +0 -0
- /package/dist/{cjs → types}/utils/number.d.ts +0 -0
- /package/dist/{cjs → types}/utils/utils.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BinaryTreeNode, BSTNode, IBinaryTree, TreeMultiMap, TreeMultiMapNode } from '../../../../src';
|
|
2
2
|
import { getRandomInt } from '../../../utils';
|
|
3
|
-
|
|
3
|
+
import { Range } from '../../../../src';
|
|
4
4
|
import { isDebugTest } from '../../../config';
|
|
5
5
|
import { costOfLiving } from './data/cost-of-living-by-country';
|
|
6
6
|
|
|
@@ -1003,3 +1003,111 @@ describe('classic use', () => {
|
|
|
1003
1003
|
]);
|
|
1004
1004
|
});
|
|
1005
1005
|
});
|
|
1006
|
+
|
|
1007
|
+
interface Product {
|
|
1008
|
+
id: string;
|
|
1009
|
+
name: string;
|
|
1010
|
+
price: number;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// Build a TreeMultiMap in "multi" mode: price -> Product[]
|
|
1014
|
+
function buildIndex(sample: Product[]): TreeMultiMap<number, Product, Product> {
|
|
1015
|
+
return new TreeMultiMap<number, Product, Product>(sample, {
|
|
1016
|
+
toEntryFn: raw => [raw.price, [raw]],
|
|
1017
|
+
isMapMode: false // ensure multi-value per key
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// Helper: normalize getLeftMost/getRightMost return (key or node.key)
|
|
1022
|
+
function leftKey(tmm: TreeMultiMap<number, Product, Product>): number | undefined {
|
|
1023
|
+
const v = tmm.getLeftMost();
|
|
1024
|
+
return v == null ? undefined : typeof v === 'object' ? v.key : v;
|
|
1025
|
+
}
|
|
1026
|
+
function rightKey(tmm: TreeMultiMap<number, Product, Product>): number | undefined {
|
|
1027
|
+
const v = tmm.getRightMost();
|
|
1028
|
+
return v == null ? undefined : typeof v === 'object' ? v.key : v;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
describe('TreeMultiMap — rangeSearch-driven semantics', () => {
|
|
1032
|
+
const sample: Product[] = [
|
|
1033
|
+
{ id: 'p1', name: 'Basic Tee', price: 35.5 },
|
|
1034
|
+
{ id: 'p2', name: 'Sport Socks', price: 12.9 },
|
|
1035
|
+
{ id: 'p3', name: 'Denim Jeans', price: 79.9 },
|
|
1036
|
+
{ id: 'p4', name: 'Hoodie', price: 79.9 },
|
|
1037
|
+
{ id: 'p5', name: 'Sneakers', price: 99.0 },
|
|
1038
|
+
{ id: 'p6', name: 'Backpack', price: 120.0 },
|
|
1039
|
+
{ id: 'p7', name: 'Watch', price: 199.0 },
|
|
1040
|
+
{ id: 'p8', name: 'Hat', price: 35.5 }
|
|
1041
|
+
];
|
|
1042
|
+
|
|
1043
|
+
it('stores multiple values under the same key and preserves insertion order in the bucket', () => {
|
|
1044
|
+
const tmm = buildIndex(sample);
|
|
1045
|
+
// Use rangeSearch on the single key [35.5, 35.5]
|
|
1046
|
+
const groups = tmm.rangeSearch(new Range(35.5, 35.5, true, true), node => node.value).flat();
|
|
1047
|
+
expect(groups.map(p => p!.id)).toEqual(['p1', 'p8']); // insertion order kept
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
it('iterates keys in ascending order (via keys())', () => {
|
|
1051
|
+
const tmm = buildIndex(sample);
|
|
1052
|
+
expect([...tmm.keys()]).toEqual([12.9, 35.5, 79.9, 99, 120, 199]);
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
it('rangeSearch respects inclusive/exclusive bounds — flat result', () => {
|
|
1056
|
+
const tmm = buildIndex(sample);
|
|
1057
|
+
|
|
1058
|
+
// [35.5, 100): include 35.5, exclude 100
|
|
1059
|
+
const res = tmm.rangeSearch(new Range(35.5, 100, true, false), node => node.value).flat();
|
|
1060
|
+
|
|
1061
|
+
expect(res.map(p => `${p!.name}($${p!.price})`)).toEqual([
|
|
1062
|
+
'Basic Tee($35.5)',
|
|
1063
|
+
'Hat($35.5)',
|
|
1064
|
+
'Denim Jeans($79.9)',
|
|
1065
|
+
'Hoodie($79.9)',
|
|
1066
|
+
'Sneakers($99)'
|
|
1067
|
+
]);
|
|
1068
|
+
expect(res.map(p => p!.id)).toEqual(['p1', 'p8', 'p3', 'p4', 'p5']);
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
it('rangeSearch returns grouped buckets — both ends exclusive', () => {
|
|
1072
|
+
const tmm = buildIndex(sample);
|
|
1073
|
+
|
|
1074
|
+
// (80, 200) → keys 99, 120, 199
|
|
1075
|
+
const groups = tmm.rangeSearch(new Range(80, 200, false, false), node => ({ key: node.key, bucket: node.value }));
|
|
1076
|
+
|
|
1077
|
+
expect(groups.map(g => g.key)).toEqual([99, 120, 199]);
|
|
1078
|
+
expect(groups.map(g => g.bucket!.map(i => i.id))).toEqual([['p5'], ['p6'], ['p7']]);
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
it('rangeSearch across full domain by using current min/max keys (no Infinity)', () => {
|
|
1082
|
+
const tmm = buildIndex(sample);
|
|
1083
|
+
const lo = tmm.getLeftMost(); // expected 12.9
|
|
1084
|
+
const hi = tmm.getRightMost(); // expected 199
|
|
1085
|
+
|
|
1086
|
+
const groups = tmm.rangeSearch(new Range(lo, hi, true, true), node => ({
|
|
1087
|
+
key: node.key,
|
|
1088
|
+
count: node.value!.length
|
|
1089
|
+
}));
|
|
1090
|
+
|
|
1091
|
+
// 12.9:1 | 35.5:2 | 79.9:2 | 99:1 | 120:1 | 199:1
|
|
1092
|
+
expect(groups.map(g => `${g.key}:${g.count}`).join(' | ')).toBe('12.9:1 | 35.5:2 | 79.9:2 | 99:1 | 120:1 | 199:1');
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
it('empty TreeMultiMap → rangeSearch returns empty results', () => {
|
|
1096
|
+
const tmm = buildIndex([]);
|
|
1097
|
+
// Any finite range should yield empty
|
|
1098
|
+
const flat = tmm.rangeSearch(new Range(0, 100, true, true), n => n.value).flat();
|
|
1099
|
+
expect(flat).toEqual([]);
|
|
1100
|
+
|
|
1101
|
+
const groups = tmm.rangeSearch(new Range(0, 100, true, true), (node: any) => ({
|
|
1102
|
+
key: node.key,
|
|
1103
|
+
bucket: node.value as Product[]
|
|
1104
|
+
}));
|
|
1105
|
+
expect(groups).toEqual([]);
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
it('left-most/right-most key helpers (if API returns node, unwrap .key)', () => {
|
|
1109
|
+
const tmm = buildIndex(sample);
|
|
1110
|
+
expect(leftKey(tmm)).toBe(12.9);
|
|
1111
|
+
expect(rightKey(tmm)).toBe(199);
|
|
1112
|
+
});
|
|
1113
|
+
});
|
package/tsconfig-base.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"allowSyntheticDefaultImports": true,
|
|
5
|
-
"baseUrl": "./",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"inlineSourceMap": false,
|
|
9
|
-
"lib": ["esnext"],
|
|
10
|
-
"listEmittedFiles": false,
|
|
11
|
-
"listFiles": false,
|
|
12
|
-
"noFallthroughCasesInSwitch": true,
|
|
13
|
-
"pretty": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"strict": true,
|
|
17
|
-
"traceResolution": false,
|
|
18
|
-
"types": ["node", "jest"], // Specifies the name of the type declaration file to include.
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"baseUrl": "./",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"inlineSourceMap": false,
|
|
9
|
+
"lib": ["esnext"],
|
|
10
|
+
"listEmittedFiles": false,
|
|
11
|
+
"listFiles": false,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"pretty": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"traceResolution": false,
|
|
19
18
|
"noImplicitOverride": true,
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
"types": ["node"]
|
|
21
21
|
},
|
|
22
|
-
"compileOnSave": false,
|
|
23
|
-
"exclude": ["node_modules", "dist"]
|
|
24
|
-
}
|
|
22
|
+
"compileOnSave": false,
|
|
23
|
+
"exclude": ["node_modules", "dist"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig-base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2018",
|
|
5
|
+
"lib": ["ES2018", "DOM"],
|
|
6
|
+
|
|
7
|
+
"module": "NodeNext",
|
|
8
|
+
"moduleResolution": "NodeNext",
|
|
9
|
+
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"emitDeclarationOnly": true,
|
|
12
|
+
"declarationMap": false,
|
|
13
|
+
"outDir": "dist/types"
|
|
14
|
+
},
|
|
15
|
+
"include": ["./src/**/*.ts"],
|
|
16
|
+
"exclude": ["dist", "node_modules", "test"]
|
|
17
|
+
}
|
package/tsup.config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig([
|
|
2
4
|
{
|
|
3
|
-
|
|
4
|
-
"data-structure-typed": "src/index.ts"
|
|
5
|
-
},
|
|
5
|
+
entry: { "data-structure-typed": "src/index.ts" },
|
|
6
6
|
target: 'es6',
|
|
7
7
|
format: ["iife"],
|
|
8
8
|
clean: true,
|
|
@@ -11,30 +11,19 @@ export default [
|
|
|
11
11
|
outDir: "dist/umd",
|
|
12
12
|
globalName: "dataStructureTyped",
|
|
13
13
|
platform: "browser",
|
|
14
|
-
|
|
15
|
-
outExtension() {
|
|
16
|
-
return {
|
|
17
|
-
js: `.min.js`,
|
|
18
|
-
}
|
|
19
|
-
},
|
|
14
|
+
outExtension: () => ({ js: '.min.js' }),
|
|
20
15
|
},
|
|
16
|
+
// 配置 2: Unminified (开发调试用)
|
|
21
17
|
{
|
|
22
|
-
|
|
23
|
-
"data-structure-typed": "src/index.ts"
|
|
24
|
-
},
|
|
18
|
+
entry: { "data-structure-typed": "src/index.ts" },
|
|
25
19
|
target: 'es6',
|
|
26
20
|
format: ["iife"],
|
|
27
|
-
clean:
|
|
28
|
-
sourcemap:
|
|
21
|
+
clean: false,
|
|
22
|
+
sourcemap: true,
|
|
29
23
|
minify: false,
|
|
30
24
|
outDir: "dist/umd",
|
|
31
25
|
globalName: "dataStructureTyped",
|
|
32
26
|
platform: "browser",
|
|
33
|
-
|
|
34
|
-
outExtension() {
|
|
35
|
-
return {
|
|
36
|
-
js: `.js`,
|
|
37
|
-
}
|
|
38
|
-
},
|
|
27
|
+
outExtension: () => ({ js: '.js' }),
|
|
39
28
|
}
|
|
40
|
-
];
|
|
29
|
+
]);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig([
|
|
4
|
+
// ESM
|
|
5
|
+
{
|
|
6
|
+
entry: { index: "src/index.ts" },
|
|
7
|
+
format: ["esm"],
|
|
8
|
+
outDir: "dist/esm",
|
|
9
|
+
splitting: false,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
minify: false,
|
|
12
|
+
keepNames: true,
|
|
13
|
+
treeshake: true,
|
|
14
|
+
clean: true,
|
|
15
|
+
target: "es2018",
|
|
16
|
+
outExtension() {
|
|
17
|
+
return { js: ".mjs" }
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// CJS
|
|
22
|
+
{
|
|
23
|
+
entry: { index: "src/index.ts" },
|
|
24
|
+
format: ["cjs"],
|
|
25
|
+
outDir: "dist/cjs",
|
|
26
|
+
splitting: false,
|
|
27
|
+
sourcemap: true,
|
|
28
|
+
minify: false,
|
|
29
|
+
keepNames: true,
|
|
30
|
+
treeshake: true,
|
|
31
|
+
clean: false,
|
|
32
|
+
target: "es2018",
|
|
33
|
+
outExtension() {
|
|
34
|
+
return { js: ".cjs" };
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]);
|
package/dist/cjs/common/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Range = exports.DFSOperation = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
var DFSOperation;
|
|
6
|
-
(function (DFSOperation) {
|
|
7
|
-
DFSOperation[DFSOperation["VISIT"] = 0] = "VISIT";
|
|
8
|
-
DFSOperation[DFSOperation["PROCESS"] = 1] = "PROCESS";
|
|
9
|
-
})(DFSOperation || (exports.DFSOperation = DFSOperation = {}));
|
|
10
|
-
class Range {
|
|
11
|
-
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
12
|
-
this.low = low;
|
|
13
|
-
this.high = high;
|
|
14
|
-
this.includeLow = includeLow;
|
|
15
|
-
this.includeHigh = includeHigh;
|
|
16
|
-
if (!((0, utils_1.isComparable)(low) && (0, utils_1.isComparable)(high)))
|
|
17
|
-
throw new RangeError('low or high is not comparable');
|
|
18
|
-
if (low > high)
|
|
19
|
-
throw new RangeError('low must be less than or equal to high');
|
|
20
|
-
}
|
|
21
|
-
// Determine whether a key is within the range
|
|
22
|
-
isInRange(key, comparator) {
|
|
23
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
24
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
25
|
-
return lowCheck && highCheck;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.Range = Range;
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,oCAAwC;AAExC,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iDAAS,CAAA;IACT,qDAAW,CAAA;AACb,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,MAAa,KAAK;IAChB,YACS,GAAM,EACN,IAAO,EACP,aAAsB,IAAI,EAC1B,cAAuB,IAAI;QAH3B,QAAG,GAAH,GAAG,CAAG;QACN,SAAI,GAAJ,IAAI,CAAG;QACP,eAAU,GAAV,UAAU,CAAgB;QAC1B,gBAAW,GAAX,WAAW,CAAgB;QAElC,IAAI,CAAC,CAAC,IAAA,oBAAY,EAAC,GAAG,CAAC,IAAI,IAAA,oBAAY,EAAC,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,+BAA+B,CAAC,CAAC;QACtG,IAAI,GAAG,GAAG,IAAI;YAAE,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;IACjF,CAAC;IAED,8CAA8C;IAC9C,SAAS,CAAC,GAAM,EAAE,UAAkC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClG,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtG,OAAO,QAAQ,IAAI,SAAS,CAAC;IAC/B,CAAC;CACF;AAjBD,sBAiBC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./iterable-entry-base"), exports);
|
|
18
|
-
__exportStar(require("./iterable-element-base"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-structures/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,0DAAwC"}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IterableElementBase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Base class that makes a data structure iterable and provides common
|
|
6
|
-
* element-wise utilities (e.g., map/filter/reduce/find).
|
|
7
|
-
*
|
|
8
|
-
* @template E The public element type yielded by the structure.
|
|
9
|
-
* @template R The underlying "raw" element type used internally or by converters.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* This class implements the JavaScript iteration protocol (via `Symbol.iterator`)
|
|
13
|
-
* and offers array-like helpers with predictable time/space complexity.
|
|
14
|
-
*/
|
|
15
|
-
class IterableElementBase {
|
|
16
|
-
/**
|
|
17
|
-
* Create a new iterable base.
|
|
18
|
-
*
|
|
19
|
-
* @param options Optional behavior overrides. When provided, a `toElementFn`
|
|
20
|
-
* is used to convert a raw element (`R`) into a public element (`E`).
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* Time O(1), Space O(1).
|
|
24
|
-
*/
|
|
25
|
-
constructor(options) {
|
|
26
|
-
if (options) {
|
|
27
|
-
const { toElementFn } = options;
|
|
28
|
-
if (typeof toElementFn === 'function')
|
|
29
|
-
this._toElementFn = toElementFn;
|
|
30
|
-
else if (toElementFn)
|
|
31
|
-
throw new TypeError('toElementFn must be a function type');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Exposes the current `toElementFn`, if configured.
|
|
36
|
-
*
|
|
37
|
-
* @returns The converter function or `undefined` when not set.
|
|
38
|
-
* @remarks
|
|
39
|
-
* Time O(1), Space O(1).
|
|
40
|
-
*/
|
|
41
|
-
get toElementFn() {
|
|
42
|
-
return this._toElementFn;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns an iterator over the structure's elements.
|
|
46
|
-
*
|
|
47
|
-
* @param args Optional iterator arguments forwarded to the internal iterator.
|
|
48
|
-
* @returns An `IterableIterator<E>` that yields the elements in traversal order.
|
|
49
|
-
*
|
|
50
|
-
* @remarks
|
|
51
|
-
* Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
|
|
52
|
-
*/
|
|
53
|
-
*[Symbol.iterator](...args) {
|
|
54
|
-
yield* this._getIterator(...args);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Returns an iterator over the values (alias of the default iterator).
|
|
58
|
-
*
|
|
59
|
-
* @returns An `IterableIterator<E>` over all elements.
|
|
60
|
-
* @remarks
|
|
61
|
-
* Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
62
|
-
*/
|
|
63
|
-
*values() {
|
|
64
|
-
for (const item of this)
|
|
65
|
-
yield item;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Tests whether all elements satisfy the predicate.
|
|
69
|
-
*
|
|
70
|
-
* @template TReturn
|
|
71
|
-
* @param predicate Function invoked for each element with signature `(value, index, self)`.
|
|
72
|
-
* @param thisArg Optional `this` binding for the predicate.
|
|
73
|
-
* @returns `true` if every element passes; otherwise `false`.
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* Time O(n) in the worst case; may exit early when the first failure is found. Space O(1).
|
|
77
|
-
*/
|
|
78
|
-
every(predicate, thisArg) {
|
|
79
|
-
let index = 0;
|
|
80
|
-
for (const item of this) {
|
|
81
|
-
if (thisArg === undefined) {
|
|
82
|
-
if (!predicate(item, index++, this))
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
const fn = predicate;
|
|
87
|
-
if (!fn.call(thisArg, item, index++, this))
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Tests whether at least one element satisfies the predicate.
|
|
95
|
-
*
|
|
96
|
-
* @param predicate Function invoked for each element with signature `(value, index, self)`.
|
|
97
|
-
* @param thisArg Optional `this` binding for the predicate.
|
|
98
|
-
* @returns `true` if any element passes; otherwise `false`.
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
* Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
102
|
-
*/
|
|
103
|
-
some(predicate, thisArg) {
|
|
104
|
-
let index = 0;
|
|
105
|
-
for (const item of this) {
|
|
106
|
-
if (thisArg === undefined) {
|
|
107
|
-
if (predicate(item, index++, this))
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
const fn = predicate;
|
|
112
|
-
if (fn.call(thisArg, item, index++, this))
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Invokes a callback for each element in iteration order.
|
|
120
|
-
*
|
|
121
|
-
* @param callbackfn Function invoked per element with signature `(value, index, self)`.
|
|
122
|
-
* @param thisArg Optional `this` binding for the callback.
|
|
123
|
-
* @returns `void`.
|
|
124
|
-
*
|
|
125
|
-
* @remarks
|
|
126
|
-
* Time O(n), Space O(1).
|
|
127
|
-
*/
|
|
128
|
-
forEach(callbackfn, thisArg) {
|
|
129
|
-
let index = 0;
|
|
130
|
-
for (const item of this) {
|
|
131
|
-
if (thisArg === undefined) {
|
|
132
|
-
callbackfn(item, index++, this);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
const fn = callbackfn;
|
|
136
|
-
fn.call(thisArg, item, index++, this);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Implementation signature
|
|
141
|
-
find(predicate, thisArg) {
|
|
142
|
-
let index = 0;
|
|
143
|
-
for (const item of this) {
|
|
144
|
-
if (thisArg === undefined) {
|
|
145
|
-
if (predicate(item, index++, this))
|
|
146
|
-
return item;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
const fn = predicate;
|
|
150
|
-
if (fn.call(thisArg, item, index++, this))
|
|
151
|
-
return item;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Checks whether a strictly-equal element exists in the structure.
|
|
158
|
-
*
|
|
159
|
-
* @param element The element to test with `===` equality.
|
|
160
|
-
* @returns `true` if an equal element is found; otherwise `false`.
|
|
161
|
-
*
|
|
162
|
-
* @remarks
|
|
163
|
-
* Time O(n) in the worst case. Space O(1).
|
|
164
|
-
*/
|
|
165
|
-
has(element) {
|
|
166
|
-
for (const ele of this)
|
|
167
|
-
if (ele === element)
|
|
168
|
-
return true;
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Reduces all elements to a single accumulated value.
|
|
173
|
-
*
|
|
174
|
-
* @overload
|
|
175
|
-
* @param callbackfn Reducer of signature `(acc, value, index, self) => nextAcc`. The first element is used as the initial accumulator.
|
|
176
|
-
* @returns The final accumulated value typed as `E`.
|
|
177
|
-
*
|
|
178
|
-
* @overload
|
|
179
|
-
* @param callbackfn Reducer of signature `(acc, value, index, self) => nextAcc`.
|
|
180
|
-
* @param initialValue The initial accumulator value of type `E`.
|
|
181
|
-
* @returns The final accumulated value typed as `E`.
|
|
182
|
-
*
|
|
183
|
-
* @overload
|
|
184
|
-
* @template U The accumulator type when it differs from `E`.
|
|
185
|
-
* @param callbackfn Reducer of signature `(acc: U, value, index, self) => U`.
|
|
186
|
-
* @param initialValue The initial accumulator value of type `U`.
|
|
187
|
-
* @returns The final accumulated value typed as `U`.
|
|
188
|
-
*
|
|
189
|
-
* @remarks
|
|
190
|
-
* Time O(n), Space O(1). Throws if called on an empty structure without `initialValue`.
|
|
191
|
-
*/
|
|
192
|
-
reduce(callbackfn, initialValue) {
|
|
193
|
-
let index = 0;
|
|
194
|
-
const iter = this[Symbol.iterator]();
|
|
195
|
-
let acc;
|
|
196
|
-
if (arguments.length >= 2) {
|
|
197
|
-
acc = initialValue;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
const first = iter.next();
|
|
201
|
-
if (first.done)
|
|
202
|
-
throw new TypeError('Reduce of empty structure with no initial value');
|
|
203
|
-
acc = first.value;
|
|
204
|
-
index = 1;
|
|
205
|
-
}
|
|
206
|
-
for (const value of iter) {
|
|
207
|
-
acc = callbackfn(acc, value, index++, this);
|
|
208
|
-
}
|
|
209
|
-
return acc;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Materializes the elements into a new array.
|
|
213
|
-
*
|
|
214
|
-
* @returns A shallow array copy of the iteration order.
|
|
215
|
-
* @remarks
|
|
216
|
-
* Time O(n), Space O(n).
|
|
217
|
-
*/
|
|
218
|
-
toArray() {
|
|
219
|
-
return [...this];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Returns a representation of the structure suitable for quick visualization.
|
|
223
|
-
* Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
224
|
-
*
|
|
225
|
-
* @returns A visual representation (array by default).
|
|
226
|
-
* @remarks
|
|
227
|
-
* Time O(n), Space O(n).
|
|
228
|
-
*/
|
|
229
|
-
toVisual() {
|
|
230
|
-
return [...this];
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Prints `toVisual()` to the console. Intended for quick debugging.
|
|
234
|
-
*
|
|
235
|
-
* @returns `void`.
|
|
236
|
-
* @remarks
|
|
237
|
-
* Time O(n) due to materialization, Space O(n) for the intermediate representation.
|
|
238
|
-
*/
|
|
239
|
-
print() {
|
|
240
|
-
console.log(this.toVisual());
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
exports.IterableElementBase = IterableElementBase;
|
|
244
|
-
//# sourceMappingURL=iterable-element-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iterable-element-base.js","sourceRoot":"","sources":["../../../../src/data-structures/base/iterable-element-base.ts"],"names":[],"mappings":"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"}
|