doubly-linked-list-typed 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/cjs/index.cjs +1299 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/esm/index.mjs +1294 -0
  4. package/dist/esm/index.mjs.map +1 -0
  5. package/dist/types/data-structures/base/index.d.ts +2 -1
  6. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +182 -2
  7. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +135 -2
  8. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +291 -2
  9. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +174 -1
  10. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +754 -29
  11. package/dist/types/data-structures/binary-tree/bst.d.ts +413 -12
  12. package/dist/types/data-structures/binary-tree/index.d.ts +3 -2
  13. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +208 -3
  14. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +160 -1
  15. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +190 -2
  16. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +270 -2
  17. package/dist/types/data-structures/graph/abstract-graph.d.ts +340 -14
  18. package/dist/types/data-structures/graph/directed-graph.d.ts +207 -1
  19. package/dist/types/data-structures/graph/index.d.ts +2 -1
  20. package/dist/types/data-structures/graph/map-graph.d.ts +78 -1
  21. package/dist/types/data-structures/graph/undirected-graph.d.ts +188 -1
  22. package/dist/types/data-structures/hash/hash-map.d.ts +345 -19
  23. package/dist/types/data-structures/hash/index.d.ts +0 -1
  24. package/dist/types/data-structures/heap/heap.d.ts +503 -5
  25. package/dist/types/data-structures/heap/index.d.ts +2 -0
  26. package/dist/types/data-structures/heap/max-heap.d.ts +32 -1
  27. package/dist/types/data-structures/heap/min-heap.d.ts +33 -1
  28. package/dist/types/data-structures/index.d.ts +7 -7
  29. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +769 -2
  30. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +451 -2
  31. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +27 -4
  32. package/dist/types/data-structures/matrix/index.d.ts +1 -1
  33. package/dist/types/data-structures/matrix/matrix.d.ts +168 -7
  34. package/dist/types/data-structures/matrix/navigator.d.ts +54 -13
  35. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +27 -1
  36. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +26 -1
  37. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +15 -2
  38. package/dist/types/data-structures/queue/deque.d.ts +431 -4
  39. package/dist/types/data-structures/queue/queue.d.ts +308 -4
  40. package/dist/types/data-structures/stack/stack.d.ts +306 -2
  41. package/dist/types/data-structures/tree/tree.d.ts +62 -1
  42. package/dist/types/data-structures/trie/trie.d.ts +350 -4
  43. package/dist/types/index.d.ts +11 -2
  44. package/dist/{interfaces → types/interfaces}/binary-tree.d.ts +1 -1
  45. package/dist/types/types/data-structures/base/index.d.ts +1 -0
  46. package/dist/types/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
  47. package/dist/types/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -0
  48. package/dist/types/types/data-structures/binary-tree/avl-tree.d.ts +2 -0
  49. package/dist/types/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
  50. package/dist/types/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
  51. package/dist/types/types/data-structures/binary-tree/bst.d.ts +12 -0
  52. package/dist/{data-structures → types/types/data-structures}/binary-tree/index.d.ts +2 -3
  53. package/dist/types/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
  54. package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
  55. package/dist/types/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
  56. package/dist/types/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -0
  57. package/dist/types/types/data-structures/graph/abstract-graph.d.ts +14 -0
  58. package/dist/types/types/data-structures/graph/directed-graph.d.ts +1 -0
  59. package/dist/{data-structures → types/types/data-structures}/graph/index.d.ts +1 -2
  60. package/dist/types/types/data-structures/graph/map-graph.d.ts +1 -0
  61. package/dist/types/types/data-structures/graph/undirected-graph.d.ts +1 -0
  62. package/dist/types/types/data-structures/hash/hash-map.d.ts +19 -0
  63. package/dist/types/types/data-structures/hash/index.d.ts +2 -0
  64. package/dist/types/types/data-structures/heap/heap.d.ts +5 -0
  65. package/dist/types/types/data-structures/heap/index.d.ts +1 -0
  66. package/dist/types/types/data-structures/heap/max-heap.d.ts +1 -0
  67. package/dist/types/types/data-structures/heap/min-heap.d.ts +1 -0
  68. package/dist/types/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -0
  69. package/dist/types/types/data-structures/linked-list/singly-linked-list.d.ts +2 -0
  70. package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +4 -0
  71. package/dist/types/types/data-structures/matrix/matrix.d.ts +7 -0
  72. package/dist/types/types/data-structures/matrix/navigator.d.ts +14 -0
  73. package/dist/types/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  74. package/dist/types/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  75. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +2 -0
  76. package/dist/types/types/data-structures/queue/deque.d.ts +4 -0
  77. package/dist/types/types/data-structures/queue/queue.d.ts +4 -0
  78. package/dist/types/types/data-structures/stack/stack.d.ts +2 -0
  79. package/dist/types/types/data-structures/tree/tree.d.ts +1 -0
  80. package/dist/types/types/data-structures/trie/trie.d.ts +4 -0
  81. package/dist/types/types/index.d.ts +3 -0
  82. package/dist/types/types/utils/index.d.ts +2 -0
  83. package/dist/types/types/utils/utils.d.ts +22 -0
  84. package/dist/types/utils/index.d.ts +1 -1
  85. package/dist/types/utils/utils.d.ts +209 -22
  86. package/dist/umd/doubly-linked-list-typed.js +1302 -0
  87. package/dist/umd/doubly-linked-list-typed.js.map +1 -0
  88. package/dist/umd/doubly-linked-list-typed.min.js +9 -0
  89. package/dist/umd/doubly-linked-list-typed.min.js.map +1 -0
  90. package/package.json +25 -5
  91. package/src/data-structures/binary-tree/avl-tree-counter.ts +4 -4
  92. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
  93. package/src/data-structures/binary-tree/avl-tree.ts +2 -2
  94. package/src/data-structures/binary-tree/binary-tree.ts +4 -4
  95. package/src/data-structures/binary-tree/bst.ts +1 -1
  96. package/src/data-structures/binary-tree/red-black-tree.ts +2 -2
  97. package/src/data-structures/binary-tree/tree-counter.ts +4 -4
  98. package/src/data-structures/binary-tree/tree-multi-map.ts +1 -1
  99. package/src/data-structures/heap/heap.ts +5 -5
  100. package/src/data-structures/linked-list/singly-linked-list.ts +2 -2
  101. package/src/interfaces/binary-tree.ts +1 -1
  102. package/tsconfig.base.json +23 -0
  103. package/tsconfig.json +8 -34
  104. package/tsconfig.test.json +8 -0
  105. package/tsconfig.types.json +15 -0
  106. package/tsup.config.js +28 -0
  107. package/tsup.node.config.js +37 -0
  108. package/dist/common/index.js +0 -28
  109. package/dist/constants/index.js +0 -8
  110. package/dist/data-structures/base/index.d.ts +0 -2
  111. package/dist/data-structures/base/index.js +0 -18
  112. package/dist/data-structures/base/iterable-element-base.js +0 -243
  113. package/dist/data-structures/base/iterable-entry-base.js +0 -183
  114. package/dist/data-structures/base/linear-base.js +0 -415
  115. package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +0 -182
  116. package/dist/data-structures/binary-tree/avl-tree-counter.js +0 -374
  117. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -135
  118. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +0 -250
  119. package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -291
  120. package/dist/data-structures/binary-tree/avl-tree.js +0 -611
  121. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
  122. package/dist/data-structures/binary-tree/binary-indexed-tree.js +0 -294
  123. package/dist/data-structures/binary-tree/binary-tree.d.ts +0 -754
  124. package/dist/data-structures/binary-tree/binary-tree.js +0 -1925
  125. package/dist/data-structures/binary-tree/bst.d.ts +0 -413
  126. package/dist/data-structures/binary-tree/bst.js +0 -903
  127. package/dist/data-structures/binary-tree/index.js +0 -26
  128. package/dist/data-structures/binary-tree/red-black-tree.d.ts +0 -208
  129. package/dist/data-structures/binary-tree/red-black-tree.js +0 -546
  130. package/dist/data-structures/binary-tree/segment-tree.d.ts +0 -160
  131. package/dist/data-structures/binary-tree/segment-tree.js +0 -297
  132. package/dist/data-structures/binary-tree/tree-counter.d.ts +0 -190
  133. package/dist/data-structures/binary-tree/tree-counter.js +0 -413
  134. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +0 -270
  135. package/dist/data-structures/binary-tree/tree-multi-map.js +0 -384
  136. package/dist/data-structures/graph/abstract-graph.d.ts +0 -340
  137. package/dist/data-structures/graph/abstract-graph.js +0 -896
  138. package/dist/data-structures/graph/directed-graph.d.ts +0 -207
  139. package/dist/data-structures/graph/directed-graph.js +0 -525
  140. package/dist/data-structures/graph/index.js +0 -20
  141. package/dist/data-structures/graph/map-graph.d.ts +0 -78
  142. package/dist/data-structures/graph/map-graph.js +0 -107
  143. package/dist/data-structures/graph/undirected-graph.d.ts +0 -188
  144. package/dist/data-structures/graph/undirected-graph.js +0 -424
  145. package/dist/data-structures/hash/hash-map.d.ts +0 -345
  146. package/dist/data-structures/hash/hash-map.js +0 -692
  147. package/dist/data-structures/hash/index.d.ts +0 -1
  148. package/dist/data-structures/hash/index.js +0 -17
  149. package/dist/data-structures/heap/heap.d.ts +0 -503
  150. package/dist/data-structures/heap/heap.js +0 -901
  151. package/dist/data-structures/heap/index.d.ts +0 -3
  152. package/dist/data-structures/heap/index.js +0 -19
  153. package/dist/data-structures/heap/max-heap.d.ts +0 -32
  154. package/dist/data-structures/heap/max-heap.js +0 -40
  155. package/dist/data-structures/heap/min-heap.d.ts +0 -33
  156. package/dist/data-structures/heap/min-heap.js +0 -31
  157. package/dist/data-structures/index.js +0 -28
  158. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +0 -769
  159. package/dist/data-structures/linked-list/doubly-linked-list.js +0 -1111
  160. package/dist/data-structures/linked-list/index.js +0 -19
  161. package/dist/data-structures/linked-list/singly-linked-list.d.ts +0 -451
  162. package/dist/data-structures/linked-list/singly-linked-list.js +0 -850
  163. package/dist/data-structures/linked-list/skip-linked-list.d.ts +0 -27
  164. package/dist/data-structures/linked-list/skip-linked-list.js +0 -144
  165. package/dist/data-structures/matrix/index.js +0 -18
  166. package/dist/data-structures/matrix/matrix.d.ts +0 -168
  167. package/dist/data-structures/matrix/matrix.js +0 -448
  168. package/dist/data-structures/matrix/navigator.d.ts +0 -55
  169. package/dist/data-structures/matrix/navigator.js +0 -111
  170. package/dist/data-structures/priority-queue/index.js +0 -19
  171. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +0 -27
  172. package/dist/data-structures/priority-queue/max-priority-queue.js +0 -34
  173. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +0 -26
  174. package/dist/data-structures/priority-queue/min-priority-queue.js +0 -24
  175. package/dist/data-structures/priority-queue/priority-queue.d.ts +0 -15
  176. package/dist/data-structures/priority-queue/priority-queue.js +0 -20
  177. package/dist/data-structures/queue/deque.d.ts +0 -431
  178. package/dist/data-structures/queue/deque.js +0 -879
  179. package/dist/data-structures/queue/index.js +0 -18
  180. package/dist/data-structures/queue/queue.d.ts +0 -308
  181. package/dist/data-structures/queue/queue.js +0 -473
  182. package/dist/data-structures/stack/index.js +0 -17
  183. package/dist/data-structures/stack/stack.d.ts +0 -306
  184. package/dist/data-structures/stack/stack.js +0 -401
  185. package/dist/data-structures/tree/index.js +0 -17
  186. package/dist/data-structures/tree/tree.d.ts +0 -62
  187. package/dist/data-structures/tree/tree.js +0 -107
  188. package/dist/data-structures/trie/index.js +0 -17
  189. package/dist/data-structures/trie/trie.d.ts +0 -350
  190. package/dist/data-structures/trie/trie.js +0 -610
  191. package/dist/index.d.ts +0 -12
  192. package/dist/index.js +0 -28
  193. package/dist/interfaces/binary-tree.js +0 -2
  194. package/dist/interfaces/doubly-linked-list.js +0 -2
  195. package/dist/interfaces/graph.js +0 -2
  196. package/dist/interfaces/heap.js +0 -2
  197. package/dist/interfaces/index.js +0 -24
  198. package/dist/interfaces/navigator.js +0 -2
  199. package/dist/interfaces/priority-queue.js +0 -2
  200. package/dist/interfaces/segment-tree.js +0 -2
  201. package/dist/interfaces/singly-linked-list.js +0 -2
  202. package/dist/types/common.js +0 -2
  203. package/dist/types/data-structures/base/base.js +0 -2
  204. package/dist/types/data-structures/base/index.js +0 -17
  205. package/dist/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
  206. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
  207. package/dist/types/data-structures/binary-tree/avl-tree.js +0 -2
  208. package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
  209. package/dist/types/data-structures/binary-tree/binary-tree.js +0 -2
  210. package/dist/types/data-structures/binary-tree/bst.js +0 -2
  211. package/dist/types/data-structures/binary-tree/index.js +0 -25
  212. package/dist/types/data-structures/binary-tree/red-black-tree.js +0 -2
  213. package/dist/types/data-structures/binary-tree/segment-tree.js +0 -2
  214. package/dist/types/data-structures/binary-tree/tree-counter.js +0 -2
  215. package/dist/types/data-structures/binary-tree/tree-multi-map.js +0 -2
  216. package/dist/types/data-structures/graph/abstract-graph.js +0 -2
  217. package/dist/types/data-structures/graph/directed-graph.js +0 -2
  218. package/dist/types/data-structures/graph/index.js +0 -19
  219. package/dist/types/data-structures/graph/map-graph.js +0 -2
  220. package/dist/types/data-structures/graph/undirected-graph.js +0 -2
  221. package/dist/types/data-structures/hash/hash-map.js +0 -2
  222. package/dist/types/data-structures/hash/index.js +0 -17
  223. package/dist/types/data-structures/heap/heap.js +0 -2
  224. package/dist/types/data-structures/heap/index.js +0 -17
  225. package/dist/types/data-structures/heap/max-heap.js +0 -2
  226. package/dist/types/data-structures/heap/min-heap.js +0 -2
  227. package/dist/types/data-structures/index.js +0 -28
  228. package/dist/types/data-structures/linked-list/doubly-linked-list.js +0 -2
  229. package/dist/types/data-structures/linked-list/index.js +0 -19
  230. package/dist/types/data-structures/linked-list/singly-linked-list.js +0 -2
  231. package/dist/types/data-structures/linked-list/skip-linked-list.js +0 -2
  232. package/dist/types/data-structures/matrix/index.js +0 -18
  233. package/dist/types/data-structures/matrix/matrix.js +0 -2
  234. package/dist/types/data-structures/matrix/navigator.js +0 -2
  235. package/dist/types/data-structures/priority-queue/index.js +0 -19
  236. package/dist/types/data-structures/priority-queue/max-priority-queue.js +0 -2
  237. package/dist/types/data-structures/priority-queue/min-priority-queue.js +0 -2
  238. package/dist/types/data-structures/priority-queue/priority-queue.js +0 -2
  239. package/dist/types/data-structures/queue/deque.js +0 -2
  240. package/dist/types/data-structures/queue/index.js +0 -18
  241. package/dist/types/data-structures/queue/queue.js +0 -2
  242. package/dist/types/data-structures/stack/index.js +0 -17
  243. package/dist/types/data-structures/stack/stack.js +0 -2
  244. package/dist/types/data-structures/tree/index.js +0 -17
  245. package/dist/types/data-structures/tree/tree.js +0 -2
  246. package/dist/types/data-structures/trie/index.js +0 -17
  247. package/dist/types/data-structures/trie/trie.js +0 -2
  248. package/dist/types/index.js +0 -19
  249. package/dist/types/utils/index.js +0 -18
  250. package/dist/types/utils/utils.js +0 -2
  251. package/dist/types/utils/validate-type.js +0 -2
  252. package/dist/utils/index.d.ts +0 -2
  253. package/dist/utils/index.js +0 -18
  254. package/dist/utils/number.js +0 -24
  255. package/dist/utils/utils.d.ts +0 -209
  256. package/dist/utils/utils.js +0 -353
  257. package/dist/{common → types/common}/index.d.ts +0 -0
  258. package/dist/{constants → types/constants}/index.d.ts +0 -0
  259. package/dist/{data-structures → types/data-structures}/base/iterable-element-base.d.ts +0 -0
  260. package/dist/{data-structures → types/data-structures}/base/iterable-entry-base.d.ts +0 -0
  261. package/dist/{data-structures → types/data-structures}/base/linear-base.d.ts +0 -0
  262. package/dist/{interfaces → types/interfaces}/doubly-linked-list.d.ts +0 -0
  263. package/dist/{interfaces → types/interfaces}/graph.d.ts +0 -0
  264. package/dist/{interfaces → types/interfaces}/heap.d.ts +0 -0
  265. package/dist/{interfaces → types/interfaces}/index.d.ts +0 -0
  266. package/dist/{interfaces → types/interfaces}/navigator.d.ts +0 -0
  267. package/dist/{interfaces → types/interfaces}/priority-queue.d.ts +0 -0
  268. package/dist/{interfaces → types/interfaces}/segment-tree.d.ts +0 -0
  269. package/dist/{interfaces → types/interfaces}/singly-linked-list.d.ts +0 -0
  270. package/dist/types/{common.d.ts → types/common.d.ts} +0 -0
  271. package/dist/types/{data-structures → types/data-structures}/base/base.d.ts +0 -0
  272. package/dist/{data-structures → types/types/data-structures}/index.d.ts +7 -7
  273. package/dist/{data-structures → types/types/data-structures}/linked-list/index.d.ts +0 -0
  274. package/dist/{data-structures → types/types/data-structures}/matrix/index.d.ts +1 -1
  275. /package/dist/{data-structures → types/types/data-structures}/priority-queue/index.d.ts +0 -0
  276. /package/dist/{data-structures → types/types/data-structures}/queue/index.d.ts +0 -0
  277. /package/dist/{data-structures → types/types/data-structures}/stack/index.d.ts +0 -0
  278. /package/dist/{data-structures → types/types/data-structures}/tree/index.d.ts +0 -0
  279. /package/dist/{data-structures → types/types/data-structures}/trie/index.d.ts +0 -0
  280. /package/dist/types/{utils → types/utils}/validate-type.d.ts +0 -0
  281. /package/dist/{utils → types/utils}/number.d.ts +0 -0
package/package.json CHANGED
@@ -1,10 +1,30 @@
1
1
  {
2
2
  "name": "doubly-linked-list-typed",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Doubly Linked List",
5
- "main": "dist/index.js",
5
+ "browser": "dist/umd/doubly-linked-list-typed.min.js",
6
+ "umd:main": "dist/umd/doubly-linked-list-typed.min.js",
7
+ "main": "dist/cjs/index.cjs",
8
+ "module": "dist/esm/index.mjs",
9
+ "types": "dist/types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "import": "./dist/esm/index.mjs",
14
+ "require": "./dist/cjs/index.cjs"
15
+ }
16
+ },
17
+ "sideEffects": false,
18
+ "engines": {
19
+ "node": ">=12.20.0",
20
+ "npm": ">=6.14.0"
21
+ },
6
22
  "scripts": {
7
- "build": "rm -rf dist && npx tsc",
23
+ "build": "npm run build:ecu",
24
+ "build:node": "tsup --config tsup.node.config.js",
25
+ "build:types": "rm -rf dist/types && tsc -p tsconfig.types.json",
26
+ "build:umd": "tsup",
27
+ "build:ecu": "npm run build:node && npm run build:types && npm run build:umd",
8
28
  "lint": "eslint --fix \"src/**/*.{js,ts}\"",
9
29
  "format": "prettier --write \"src/**/*.{js,ts}\"",
10
30
  "test": "jest",
@@ -46,7 +66,6 @@
46
66
  "url": "https://github.com/zrwusa/data-structure-typed/issues"
47
67
  },
48
68
  "homepage": "https://data-structure-typed-docs.vercel.app",
49
- "types": "dist/index.d.ts",
50
69
  "devDependencies": {
51
70
  "@types/jest": "^29.5.3",
52
71
  "@types/node": "^20.4.9",
@@ -60,10 +79,11 @@
60
79
  "jest": "^29.6.2",
61
80
  "prettier": "^3.0.3",
62
81
  "ts-jest": "^29.1.1",
82
+ "tsup": "^8.5.1",
63
83
  "typedoc": "^0.25.1",
64
84
  "typescript": "^4.9.5"
65
85
  },
66
86
  "dependencies": {
67
- "data-structure-typed": "^2.1.1"
87
+ "data-structure-typed": "^2.1.2"
68
88
  }
69
89
  }
@@ -130,7 +130,7 @@ export class AVLTreeCounter<K = any, V = any, R = any> extends AVLTree<K, V, R>
130
130
  return sum;
131
131
  }
132
132
 
133
- override _createNode(key: K, value?: V, count?: number): AVLTreeCounterNode<K, V> {
133
+ override createNode(key: K, value?: V, count?: number): AVLTreeCounterNode<K, V> {
134
134
  return new AVLTreeCounterNode(key, this._isMapMode ? undefined : value, count) as AVLTreeCounterNode<K, V>;
135
135
  }
136
136
 
@@ -391,10 +391,10 @@ export class AVLTreeCounter<K = any, V = any, R = any> extends AVLTree<K, V, R>
391
391
  const [key, entryValue] = keyNodeOrEntry;
392
392
  if (key === undefined || key === null) return [undefined, undefined];
393
393
  const finalValue = value ?? entryValue;
394
- return [this._createNode(key, finalValue, count), finalValue];
394
+ return [this.createNode(key, finalValue, count), finalValue];
395
395
  }
396
396
 
397
- return [this._createNode(keyNodeOrEntry, value, count), value];
397
+ return [this.createNode(keyNodeOrEntry, value, count), value];
398
398
  }
399
399
 
400
400
  /**
@@ -412,7 +412,7 @@ export class AVLTreeCounter<K = any, V = any, R = any> extends AVLTree<K, V, R>
412
412
  destNode = this.ensureNode(destNode);
413
413
  if (srcNode && destNode) {
414
414
  const { key, value, count, height } = destNode;
415
- const tempNode = this._createNode(key, value, count);
415
+ const tempNode = this.createNode(key, value, count);
416
416
  if (tempNode) {
417
417
  tempNode.height = height;
418
418
 
@@ -113,7 +113,7 @@ export class AVLTreeMultiMap<K = any, V = any, R = any> extends AVLTree<K, V[],
113
113
  }
114
114
  }
115
115
 
116
- override _createNode(key: K, value: V[] = []): AVLTreeMultiMapNode<K, V> {
116
+ override createNode(key: K, value: V[] = []): AVLTreeMultiMapNode<K, V> {
117
117
  return new AVLTreeMultiMapNode<K, V>(key, this._isMapMode ? [] : value);
118
118
  }
119
119
 
@@ -196,7 +196,7 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
196
196
  * @param [value] - The value for the new node.
197
197
  * @returns The newly created AVLTreeNode.
198
198
  */
199
- override _createNode(key: K, value?: V): AVLTreeNode<K, V> {
199
+ override createNode(key: K, value?: V): AVLTreeNode<K, V> {
200
200
  return new AVLTreeNode<K, V>(key, this._isMapMode ? undefined : value) as AVLTreeNode<K, V>;
201
201
  }
202
202
 
@@ -370,7 +370,7 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
370
370
 
371
371
  if (srcNodeEnsured && destNodeEnsured) {
372
372
  const { key, value, height } = destNodeEnsured;
373
- const tempNode = this._createNode(key, value);
373
+ const tempNode = this.createNode(key, value);
374
374
 
375
375
  if (tempNode) {
376
376
  tempNode.height = height;
@@ -390,7 +390,7 @@ export class BinaryTree<K = any, V = any, R = any>
390
390
  * @param [value] - The value for the new node (used if not in Map mode).
391
391
  * @returns The newly created node.
392
392
  */
393
- _createNode(key: K, value?: V): BinaryTreeNode<K, V> {
393
+ createNode(key: K, value?: V): BinaryTreeNode<K, V> {
394
394
  return new BinaryTreeNode<K, V>(key, this._isMapMode ? undefined : value);
395
395
  }
396
396
 
@@ -2019,10 +2019,10 @@ export class BinaryTree<K = any, V = any, R = any>
2019
2019
  if (key === undefined) return [undefined, undefined];
2020
2020
  else if (key === null) return [null, undefined];
2021
2021
  const finalValue = value ?? entryValue;
2022
- return [this._createNode(key, finalValue), finalValue];
2022
+ return [this.createNode(key, finalValue), finalValue];
2023
2023
  }
2024
2024
 
2025
- return [this._createNode(keyNodeOrEntry, value), value];
2025
+ return [this.createNode(keyNodeOrEntry, value), value];
2026
2026
  }
2027
2027
 
2028
2028
  /**
@@ -2147,7 +2147,7 @@ export class BinaryTree<K = any, V = any, R = any>
2147
2147
 
2148
2148
  if (srcNode && destNode) {
2149
2149
  const { key, value } = destNode;
2150
- const tempNode = this._createNode(key, value); // Use a temp node to hold dest properties
2150
+ const tempNode = this.createNode(key, value); // Use a temp node to hold dest properties
2151
2151
 
2152
2152
  if (tempNode) {
2153
2153
  // Copy src to dest
@@ -268,7 +268,7 @@ export class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R> implemen
268
268
  * @param [value] - The value for the new node (used if not in Map mode).
269
269
  * @returns The newly created BSTNode.
270
270
  */
271
- override _createNode(key: K, value?: V): BSTNode<K, V> {
271
+ override createNode(key: K, value?: V): BSTNode<K, V> {
272
272
  return new BSTNode<K, V>(key, this._isMapMode ? undefined : value);
273
273
  }
274
274
 
@@ -89,7 +89,7 @@ export class RedBlackTreeNode<K = any, V = any> extends BSTNode<K, V> {
89
89
  }
90
90
 
91
91
  /**
92
- * RRRRRRRRRRRRRRRRRRRed-Black Tree (self-balancing BST) supporting map-like mode and stable O(log n) updates.
92
+ * Represents a Red-Black Tree (self-balancing BST) supporting map-like mode and stable O(log n) updates.
93
93
  * @remarks Time O(1), Space O(1)
94
94
  * @template K
95
95
  * @template V
@@ -176,7 +176,7 @@ export class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R> implem
176
176
  * @param color - See parameter type for details.
177
177
  * @returns A new RedBlackTreeNode instance.
178
178
  */
179
- override _createNode(key: K, value?: V, color: RBTNColor = 'BLACK'): RedBlackTreeNode<K, V> {
179
+ override createNode(key: K, value?: V, color: RBTNColor = 'BLACK'): RedBlackTreeNode<K, V> {
180
180
  return new RedBlackTreeNode<K, V>(key, this._isMapMode ? undefined : value, color);
181
181
  }
182
182
 
@@ -142,7 +142,7 @@ export class TreeCounter<K = any, V = any, R = any> extends RedBlackTree<K, V, R
142
142
  return sum;
143
143
  }
144
144
 
145
- override _createNode(key: K, value?: V, color: RBTNColor = 'BLACK', count?: number): TreeCounterNode<K, V> {
145
+ override createNode(key: K, value?: V, color: RBTNColor = 'BLACK', count?: number): TreeCounterNode<K, V> {
146
146
  return new TreeCounterNode(key, this._isMapMode ? undefined : value, count, color) as TreeCounterNode<K, V>;
147
147
  }
148
148
 
@@ -427,10 +427,10 @@ export class TreeCounter<K = any, V = any, R = any> extends RedBlackTree<K, V, R
427
427
  const [key, entryValue] = keyNodeOrEntry;
428
428
  if (key === undefined || key === null) return [undefined, undefined];
429
429
  const finalValue = value ?? entryValue;
430
- return [this._createNode(key, finalValue, 'BLACK', count), finalValue];
430
+ return [this.createNode(key, finalValue, 'BLACK', count), finalValue];
431
431
  }
432
432
 
433
- return [this._createNode(keyNodeOrEntry, value, 'BLACK', count), value];
433
+ return [this.createNode(keyNodeOrEntry, value, 'BLACK', count), value];
434
434
  }
435
435
 
436
436
  /**
@@ -448,7 +448,7 @@ export class TreeCounter<K = any, V = any, R = any> extends RedBlackTree<K, V, R
448
448
  destNode = this.ensureNode(destNode);
449
449
  if (srcNode && destNode) {
450
450
  const { key, value, count, color } = destNode;
451
- const tempNode = this._createNode(key, value, color, count);
451
+ const tempNode = this.createNode(key, value, color, count);
452
452
  if (tempNode) {
453
453
  tempNode.color = color;
454
454
 
@@ -270,7 +270,7 @@ export class TreeMultiMap<K = any, V = any, R = any> extends RedBlackTree<K, V[]
270
270
  }
271
271
  }
272
272
 
273
- override _createNode(key: K, value: V[] = []): TreeMultiMapNode<K, V> {
273
+ override createNode(key: K, value: V[] = []): TreeMultiMapNode<K, V> {
274
274
  return new TreeMultiMapNode<K, V>(key, this._isMapMode ? [] : value);
275
275
  }
276
276
 
@@ -190,7 +190,7 @@ import { IterableElementBase } from '../base';
190
190
  * ]);
191
191
  * console.log(scheduleTasks(tasks, 2)); // expectedMap
192
192
  */
193
- export class Heap<E = unknown, R = never> extends IterableElementBase<E, R> {
193
+ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
194
194
  protected _equals: (a: E, b: E) => boolean = Object.is;
195
195
 
196
196
  /**
@@ -255,7 +255,7 @@ export class Heap<E = unknown, R = never> extends IterableElementBase<E, R> {
255
255
  * @returns A new heap instance of this class.
256
256
  */
257
257
 
258
- static from<T, R = never, S extends Heap<T, R> = Heap<T, R>>(
258
+ static from<T, R = any, S extends Heap<T, R> = Heap<T, R>>(
259
259
  this: new (elements?: Iterable<T | R>, options?: HeapOptions<T, R>) => S,
260
260
  elements?: Iterable<T | R>,
261
261
  options?: HeapOptions<T, R>
@@ -273,7 +273,7 @@ export class Heap<E = unknown, R = never> extends IterableElementBase<E, R> {
273
273
  * @returns A new Heap built from elements.
274
274
  */
275
275
 
276
- static heapify<EE = unknown, RR = never>(elements: Iterable<EE>, options: HeapOptions<EE, RR>): Heap<EE, RR> {
276
+ static heapify<EE = any, RR = any>(elements: Iterable<EE>, options: HeapOptions<EE, RR>): Heap<EE, RR> {
277
277
  return new Heap<EE, RR>(elements, options);
278
278
  }
279
279
 
@@ -788,7 +788,7 @@ export class FibonacciHeap<E> {
788
788
  */
789
789
 
790
790
  push(element: E): this {
791
- const node = this._createNode(element);
791
+ const node = this.createNode(element);
792
792
  node.left = node;
793
793
  node.right = node;
794
794
  this.mergeWithRoot(node);
@@ -900,7 +900,7 @@ export class FibonacciHeap<E> {
900
900
  heapToMerge.clear();
901
901
  }
902
902
 
903
- _createNode(element: E): FibonacciHeapNode<E> {
903
+ createNode(element: E): FibonacciHeapNode<E> {
904
904
  return new FibonacciHeapNode<E>(element);
905
905
  }
906
906
 
@@ -781,7 +781,7 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
781
781
  * @returns A new SinglyLinkedListNode instance.
782
782
  */
783
783
 
784
- protected _createNode(value: E): SinglyLinkedListNode<E> {
784
+ protected createNode(value: E): SinglyLinkedListNode<E> {
785
785
  return new SinglyLinkedListNode<E>(value);
786
786
  }
787
787
 
@@ -807,7 +807,7 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
807
807
 
808
808
  protected _ensureNode(elementOrNode: E | SinglyLinkedListNode<E>) {
809
809
  if (this.isNode(elementOrNode)) return elementOrNode;
810
- return this._createNode(elementOrNode);
810
+ return this.createNode(elementOrNode);
811
811
  }
812
812
 
813
813
  /**
@@ -32,7 +32,7 @@ export interface IBinaryTree<K = any, V = any, R = any> {
32
32
  readonly isDuplicate: boolean;
33
33
 
34
34
  // ---- construction / mutation ----
35
- _createNode(key: K, value?: BinaryTreeNode<K, V>['value']): BinaryTreeNode<K, V>;
35
+ createNode(key: K, value?: BinaryTreeNode<K, V>['value']): BinaryTreeNode<K, V>;
36
36
 
37
37
  createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): IBinaryTree<K, V, R>;
38
38
 
@@ -0,0 +1,23 @@
1
+ {
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
+ "noImplicitOverride": true,
19
+ "types": ["node"]
20
+ },
21
+ "compileOnSave": false,
22
+ "exclude": ["node_modules", "dist"]
23
+ }
package/tsconfig.json CHANGED
@@ -1,38 +1,12 @@
1
1
  {
2
+ "extends": "./tsconfig.base.json",
2
3
  "compilerOptions": {
3
- "declaration": true,
4
- "outDir": "./dist",
5
- "module": "commonjs",
6
- "target": "es6",
7
- "lib": [
8
- // "es2015",
9
- "esnext"
10
- ],
11
- "strict": true,
12
- "esModuleInterop": true,
13
- "moduleResolution": "node",
14
- "declarationDir": "./dist",
15
- "skipLibCheck": true,
16
- "downlevelIteration": true,
17
- "experimentalDecorators": true,
18
- // "allowJs": true,
19
- // "allowSyntheticDefaultImports": true,
20
- // "forceConsistentCasingInFileNames": true,
21
- // "noFallthroughCasesInSwitch": true,
22
- // "resolveJsonModule": true,
23
- // "isolatedModules": true,
24
- // "noEmit": true,
25
- "typeRoots": [
26
- "node_modules/@types"
27
- ]
4
+ "rootDir": "./",
5
+ "outDir": "dist/dev",
6
+ "module": "NodeNext",
7
+ "target": "ESNext",
8
+ "moduleResolution": "NodeNext",
9
+ "sourceMap": true
28
10
  },
29
- "include": [
30
- "src"
31
- ],
32
- "exclude": [
33
- // "node_modules/data-structure-typed",
34
- "node_modules",
35
- "dist"
36
- ]
11
+ "include": ["./src/**/*.ts"]
37
12
  }
38
-
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": ["node", "jest"]
6
+ },
7
+ "include": ["./test/**/*.ts"]
8
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "target": "ES2018",
5
+ "lib": ["ES2018", "DOM"],
6
+ "module": "NodeNext",
7
+ "moduleResolution": "NodeNext",
8
+ "declaration": true,
9
+ "emitDeclarationOnly": true,
10
+ "declarationMap": false,
11
+ "outDir": "dist/types"
12
+ },
13
+ "include": ["./src/**/*.ts"],
14
+ "exclude": ["dist", "node_modules", "test"]
15
+ }
package/tsup.config.js ADDED
@@ -0,0 +1,28 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig([
4
+ {
5
+ entry: { "doubly-linked-list-typed": "src/index.ts" },
6
+ target: 'es2018',
7
+ format: ["iife"],
8
+ clean: true,
9
+ sourcemap: true,
10
+ minify: true,
11
+ outDir: "dist/umd",
12
+ globalName: "doublyLinkedListTyped",
13
+ platform: "browser",
14
+ outExtension: () => ({ js: '.min.js' }),
15
+ },
16
+ {
17
+ entry: { "doubly-linked-list-typed": "src/index.ts" },
18
+ target: 'es2018',
19
+ format: ["iife"],
20
+ clean: false,
21
+ sourcemap: true,
22
+ minify: false,
23
+ outDir: "dist/umd",
24
+ globalName: "doublyLinkedListTyped",
25
+ platform: "browser",
26
+ outExtension: () => ({ js: '.js' }),
27
+ }
28
+ ]);
@@ -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
+ ]);
@@ -1,28 +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 || (exports.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;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DFSOperation = void 0;
4
- var DFSOperation;
5
- (function (DFSOperation) {
6
- DFSOperation[DFSOperation["VISIT"] = 0] = "VISIT";
7
- DFSOperation[DFSOperation["PROCESS"] = 1] = "PROCESS";
8
- })(DFSOperation = exports.DFSOperation || (exports.DFSOperation = {}));
@@ -1,2 +0,0 @@
1
- export * from './iterable-entry-base';
2
- export * from './iterable-element-base';
@@ -1,18 +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);