list-toolkit 2.2.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +40 -36
  2. package/llms-full.txt +743 -0
  3. package/llms.txt +100 -0
  4. package/package.json +40 -32
  5. package/src/cache/cache-fifo.d.ts +6 -0
  6. package/src/cache/cache-fifo.js +7 -4
  7. package/src/cache/cache-lfu.d.ts +18 -0
  8. package/src/cache/cache-lfu.js +18 -6
  9. package/src/cache/cache-lru.d.ts +74 -0
  10. package/src/cache/cache-lru.js +60 -5
  11. package/src/cache/cache-random.d.ts +20 -0
  12. package/src/cache/cache-random.js +17 -6
  13. package/src/cache/decorator.d.ts +46 -0
  14. package/src/cache/decorator.js +26 -2
  15. package/src/cache.d.ts +13 -0
  16. package/src/cache.js +7 -2
  17. package/src/ext-list.d.ts +3 -0
  18. package/src/ext-list.js +0 -2
  19. package/src/ext-slist.d.ts +3 -0
  20. package/src/ext-slist.js +0 -2
  21. package/src/ext-value-list.d.ts +3 -0
  22. package/src/ext-value-list.js +0 -2
  23. package/src/ext-value-slist.d.ts +3 -0
  24. package/src/ext-value-slist.js +0 -2
  25. package/src/heap/basics.d.ts +89 -0
  26. package/src/heap/basics.js +42 -5
  27. package/src/heap/leftist-heap.d.ts +107 -0
  28. package/src/heap/leftist-heap.js +54 -2
  29. package/src/heap/min-heap.d.ts +270 -0
  30. package/src/heap/min-heap.js +186 -2
  31. package/src/heap/skew-heap.d.ts +105 -0
  32. package/src/heap/skew-heap.js +54 -2
  33. package/src/heap.d.ts +3 -0
  34. package/src/heap.js +0 -2
  35. package/src/list/basics.d.ts +43 -0
  36. package/src/list/basics.js +26 -8
  37. package/src/list/core.d.ts +271 -0
  38. package/src/list/core.js +162 -7
  39. package/src/list/ext-value.d.ts +253 -0
  40. package/src/list/ext-value.js +40 -6
  41. package/src/list/ext.d.ts +242 -0
  42. package/src/list/ext.js +148 -10
  43. package/src/list/nodes.d.ts +336 -0
  44. package/src/list/nodes.js +141 -3
  45. package/src/list/ptr.d.ts +72 -0
  46. package/src/list/ptr.js +44 -2
  47. package/src/list/value.d.ts +292 -0
  48. package/src/list/value.js +47 -6
  49. package/src/list-helpers.d.ts +44 -0
  50. package/src/list-helpers.js +36 -3
  51. package/src/list-utils.d.ts +141 -0
  52. package/src/list-utils.js +89 -3
  53. package/src/list.d.ts +3 -0
  54. package/src/list.js +0 -2
  55. package/src/meta-utils.d.ts +212 -0
  56. package/src/meta-utils.js +152 -1
  57. package/src/nt-utils.d.ts +91 -0
  58. package/src/nt-utils.js +65 -4
  59. package/src/queue.d.ts +74 -0
  60. package/src/queue.js +28 -2
  61. package/src/slist/basics.d.ts +47 -0
  62. package/src/slist/basics.js +23 -8
  63. package/src/slist/core.d.ts +251 -0
  64. package/src/slist/core.js +151 -6
  65. package/src/slist/ext-value.d.ts +188 -0
  66. package/src/slist/ext-value.js +35 -6
  67. package/src/slist/ext.d.ts +182 -0
  68. package/src/slist/ext.js +114 -12
  69. package/src/slist/nodes.d.ts +361 -0
  70. package/src/slist/nodes.js +156 -3
  71. package/src/slist/ptr.d.ts +73 -0
  72. package/src/slist/ptr.js +45 -2
  73. package/src/slist/value.d.ts +246 -0
  74. package/src/slist/value.js +38 -6
  75. package/src/slist.d.ts +3 -0
  76. package/src/slist.js +0 -2
  77. package/src/stack.d.ts +59 -0
  78. package/src/stack.js +29 -3
  79. package/src/tree/splay-tree.d.ts +151 -0
  80. package/src/tree/splay-tree.js +94 -3
  81. package/src/value-list.d.ts +3 -0
  82. package/src/value-list.js +0 -2
  83. package/src/value-slist.d.ts +3 -0
  84. package/src/value-slist.js +0 -2
  85. package/cjs/cache/cache-fifo.js +0 -37
  86. package/cjs/cache/cache-lfu.js +0 -76
  87. package/cjs/cache/cache-lru.js +0 -100
  88. package/cjs/cache/cache-random.js +0 -77
  89. package/cjs/cache/decorator.js +0 -47
  90. package/cjs/cache.js +0 -27
  91. package/cjs/ext-list.js +0 -21
  92. package/cjs/ext-slist.js +0 -21
  93. package/cjs/ext-value-list.js +0 -21
  94. package/cjs/ext-value-slist.js +0 -21
  95. package/cjs/heap/basics.js +0 -63
  96. package/cjs/heap/leftist-heap.js +0 -124
  97. package/cjs/heap/min-heap.js +0 -294
  98. package/cjs/heap/skew-heap.js +0 -114
  99. package/cjs/heap.js +0 -21
  100. package/cjs/list/basics.js +0 -88
  101. package/cjs/list/core.js +0 -305
  102. package/cjs/list/ext-value.js +0 -88
  103. package/cjs/list/ext.js +0 -356
  104. package/cjs/list/nodes.js +0 -240
  105. package/cjs/list/ptr.js +0 -61
  106. package/cjs/list/value.js +0 -99
  107. package/cjs/list-helpers.js +0 -91
  108. package/cjs/list-utils.js +0 -141
  109. package/cjs/list.js +0 -21
  110. package/cjs/meta-utils.js +0 -171
  111. package/cjs/nt-utils.js +0 -132
  112. package/cjs/package.json +0 -1
  113. package/cjs/queue.js +0 -58
  114. package/cjs/slist/basics.js +0 -71
  115. package/cjs/slist/core.js +0 -362
  116. package/cjs/slist/ext-value.js +0 -82
  117. package/cjs/slist/ext.js +0 -336
  118. package/cjs/slist/nodes.js +0 -276
  119. package/cjs/slist/ptr.js +0 -87
  120. package/cjs/slist/value.js +0 -90
  121. package/cjs/slist.js +0 -21
  122. package/cjs/stack.js +0 -55
  123. package/cjs/tree/splay-tree.js +0 -362
  124. package/cjs/value-list.js +0 -21
  125. package/cjs/value-slist.js +0 -21
package/README.md CHANGED
@@ -9,40 +9,42 @@ suitable to use in all environments including browsers.
9
9
 
10
10
  The toolkit provides the following data structures with a full set of efficiently implemented operations:
11
11
 
12
- * Converters for `null`-terminated (NT) lists, both singly and doubly linked. They convert in place from NT lists to circular lists and back.
13
- * Various lists:
14
- * Doubly linked circular lists (DLL) and singly linked circular lists (SLL).
15
- * Value-based lists, where a list serves as a container for external objects, and node-based lists, where a list uses custom properties on external objects to link them around.
16
- * Hosted lists, which use a special head node to manage nodes, and headless lists, which point to an external list without including any headers.
17
- * Heaps:
18
- * Priority queues: min heap, leftist heap, skew heap.
19
- * Various list-based data structures:
20
- * Caches with various eviction algorithms: least recently used (LRU), least frequently used (LFU), first in first out (FIFO), and random.
21
- * A decorator is provided to decorate functions, methods, and getters with a cache of your choice.
22
- * Queue: an adapter for lists.
23
- * Numerous list utilities.
12
+ - Converters for `null`-terminated (NT) lists, both singly and doubly linked. They convert in place from NT lists to circular lists and back.
13
+ - Various lists:
14
+ - Doubly linked circular lists (DLL) and singly linked circular lists (SLL).
15
+ - Value-based lists, where a list serves as a container for external objects, and node-based lists, where a list uses custom properties on external objects to link them around.
16
+ - Hosted lists, which use a special head node to manage nodes, and headless lists, which point to an external list without including any headers.
17
+ - Heaps:
18
+ - Priority queues: min heap, leftist heap, skew heap.
19
+ - Various list-based data structures:
20
+ - Caches with various eviction algorithms: least recently used (LRU), least frequently used (LFU), first in first out (FIFO), and random.
21
+ - A decorator is provided to decorate functions, methods, and getters with a cache of your choice.
22
+ - Queue and Stack: adapters for lists.
23
+ - Trees:
24
+ - Splay tree: a self-adjusting binary search tree.
25
+ - Numerous list utilities.
24
26
 
25
27
  All lists can be used without the toolkit. Your existing lists, either doubly or singly linked,
26
28
  can be used. The toolkit provides a few utilities that you would write yourself if you wanted to use them.
27
29
 
28
30
  The implementation philosophy was very simple:
29
31
 
30
- * Flexibility, efficiency, and simplicity.
31
- * No dependencies. No unexpected surprises.
32
- * You never pay for what you don't use.
33
- * Suitable for all environments.
34
- * Should be usable with already existing lists.
35
- * Could be used as a foundation for other list-based data structures.
32
+ - Flexibility, efficiency, and simplicity.
33
+ - No dependencies. No unexpected surprises.
34
+ - You never pay for what you don't use.
35
+ - Suitable for all environments.
36
+ - Should be usable with already existing lists.
37
+ - Could be used as a foundation for other list-based data structures.
36
38
 
37
- **Read all about the implemented ideas in the [Backgrounders](./Backgrounder).**
39
+ **Read all about the implemented ideas in the [Backgrounder](https://github.com/uhop/list-toolkit/wiki/Backgrounder).**
38
40
 
39
41
  All lists support similar intuitive interfaces:
40
42
 
41
- * Creating from existing objects.
42
- * Adding, inserting, extracting and removing nodes.
43
- * Forward and reverse iterators.
44
- * General manipulations like reversing and sorting.
45
- * Link names for the next and previous links (for doubly linked lists) are customizable.
43
+ - Creating from existing objects.
44
+ - Adding, inserting, extracting and removing nodes.
45
+ - Forward and reverse iterators.
46
+ - General manipulations like reversing and sorting.
47
+ - Link names for the next and previous links (for doubly linked lists) are customizable.
46
48
 
47
49
  All facilities are efficient, well-debugged, and battle-tested.
48
50
 
@@ -79,7 +81,7 @@ for (const value of list) {
79
81
  list.pushBack(4);
80
82
  list.pushFront(0);
81
83
 
82
- console.log(list.popFront().value); // 0
84
+ console.log(list.popFront()); // 0
83
85
  console.log(list.front.value); // 1
84
86
  ```
85
87
 
@@ -92,7 +94,7 @@ class Person {
92
94
  constructor(name) {
93
95
  this.name = name;
94
96
  }
95
- };
97
+ }
96
98
 
97
99
  const john = new Person('John'),
98
100
  jane = new Person('Jane'),
@@ -126,7 +128,7 @@ for (const node of people) {
126
128
  }
127
129
 
128
130
  // let's extract all people from Jill to Jim
129
- const ji = people.extract({from: jill, to: jim});
131
+ const ji = people.extractRange({from: jill, to: jim});
130
132
  for (const node of people) console.log(node.name); // Jane, John
131
133
  for (const node of ji) console.log(node.name); // Jim, Jill
132
134
 
@@ -146,14 +148,16 @@ BSD 3-Clause "New" or "Revised" License. See the LICENSE file for details.
146
148
 
147
149
  ## Release History
148
150
 
149
- * 2.2.5 *Updated dev dependencies.*
150
- * 2.2.4 *Updated dev dependencies.*
151
- * 2.2.3 *Updated dev dependencies.*
152
- * 2.2.2 *Updated dev dependencies.*
153
- * 2.2.1 *Technical release: updated deps, added more tests.*
154
- * 2.2.0 *Added leftist and skew heaps.*
155
- * 2.1.1 *Allowed functions to be used as nodes. Updated deps.*
156
- * 2.1.0 *Added splay tree. Updated deps.*
157
- * 2.0.0 *New major release.*
151
+ - 2.3.0 _Added TypeScript declarations for all modules. Added JSDoc. Removed CJS build. Bugfixes. Added missing methods._
152
+ - 2.2.6 _Updated dev dependencies._
153
+ - 2.2.5 _Updated dev dependencies._
154
+ - 2.2.4 _Updated dev dependencies._
155
+ - 2.2.3 _Updated dev dependencies._
156
+ - 2.2.2 _Updated dev dependencies._
157
+ - 2.2.1 _Technical release: updated deps, added more tests._
158
+ - 2.2.0 _Added leftist and skew heaps._
159
+ - 2.1.1 _Allowed functions to be used as nodes. Updated deps._
160
+ - 2.1.0 _Added splay tree. Updated deps._
161
+ - 2.0.0 _New major release._
158
162
 
159
163
  For more info consult full [release notes](https://github.com/uhop/list-toolkit/wiki/Release-notes).