collect-your-stuff 2.1.1 → 2.2.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 (75) hide show
  1. package/README.md +32 -3241
  2. package/browser/collect-your-stuff.js +1585 -1193
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
  5. package/dist/collections/arrayable/ArrayElement.js +64 -66
  6. package/dist/collections/arrayable/Arrayable.d.ts +107 -122
  7. package/dist/collections/arrayable/Arrayable.js +208 -223
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
  12. package/dist/collections/linked-list/LinkedList.d.ts +110 -126
  13. package/dist/collections/linked-list/LinkedList.js +283 -296
  14. package/dist/collections/linked-list/Linker.d.ts +41 -46
  15. package/dist/collections/linked-list/Linker.js +82 -84
  16. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
  17. package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
  18. package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
  19. package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
  20. package/dist/collections/queue/Queue.d.ts +55 -59
  21. package/dist/collections/queue/Queue.js +114 -119
  22. package/dist/collections/queue/Queueable.d.ts +74 -83
  23. package/dist/collections/queue/Queueable.js +142 -146
  24. package/dist/collections/queue/TaskQueue.d.ts +59 -68
  25. package/dist/collections/queue/TaskQueue.js +128 -137
  26. package/dist/collections/scoped-collection/ScopedCollection.d.ts +42 -0
  27. package/dist/collections/scoped-collection/ScopedCollection.js +81 -0
  28. package/dist/collections/scoped-collection/ScopedCollection.min.js +1 -0
  29. package/dist/collections/stack/Stack.d.ts +60 -64
  30. package/dist/collections/stack/Stack.js +122 -127
  31. package/dist/collections/stack/Stackable.d.ts +52 -59
  32. package/dist/collections/stack/Stackable.js +81 -85
  33. package/dist/collections/stack/TaskStack.d.ts +56 -65
  34. package/dist/collections/stack/TaskStack.js +98 -107
  35. package/dist/main.d.ts +4 -5
  36. package/dist/main.js +9 -5
  37. package/dist/main.min.js +1 -1
  38. package/dist/recipes/ArrayIterator.d.ts +20 -20
  39. package/dist/recipes/ArrayIterator.js +39 -39
  40. package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
  41. package/dist/recipes/DoubleLinkerIterator.js +33 -33
  42. package/dist/recipes/IsArrayable.d.ts +85 -105
  43. package/dist/recipes/IsArrayable.js +5 -5
  44. package/dist/recipes/IsDoubleLinker.d.ts +14 -14
  45. package/dist/recipes/IsDoubleLinker.js +5 -5
  46. package/dist/recipes/IsElement.d.ts +14 -14
  47. package/dist/recipes/IsElement.js +5 -5
  48. package/dist/recipes/IsLinker.d.ts +10 -10
  49. package/dist/recipes/IsLinker.js +5 -5
  50. package/dist/recipes/IsQueue.d.ts +32 -37
  51. package/dist/recipes/IsQueue.js +5 -5
  52. package/dist/recipes/IsScopedCollection.d.ts +27 -0
  53. package/dist/recipes/IsScopedCollection.js +5 -0
  54. package/dist/recipes/IsScopedCollection.min.js +1 -0
  55. package/dist/recipes/IsStack.d.ts +31 -36
  56. package/dist/recipes/IsStack.js +5 -5
  57. package/dist/recipes/IsTree.d.ts +11 -11
  58. package/dist/recipes/IsTree.js +5 -5
  59. package/dist/recipes/IsTreeNode.d.ts +29 -29
  60. package/dist/recipes/IsTreeNode.js +5 -5
  61. package/dist/recipes/LinkerIterator.d.ts +18 -18
  62. package/dist/recipes/LinkerIterator.js +33 -33
  63. package/dist/recipes/Runnable.d.ts +42 -55
  64. package/dist/recipes/Runnable.js +63 -69
  65. package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
  66. package/dist/recipes/TreeLinkerIterator.js +36 -36
  67. package/dist/recipes/recipes.d.ts +12 -15
  68. package/dist/recipes/recipes.js +19 -22
  69. package/dist/services/parseTree.d.ts +8 -9
  70. package/dist/services/parseTree.js +23 -24
  71. package/dist/services/parseTreeNext.d.ts +16 -17
  72. package/dist/services/parseTreeNext.js +41 -42
  73. package/dist/services/services.d.ts +10 -13
  74. package/dist/services/services.js +19 -22
  75. package/package.json +4 -4
@@ -1,126 +1,110 @@
1
- /**
2
- * @file linked list.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.1.0
5
- * @memberOf module:collect-your-stuff
6
- */
7
- import { forEachCallback, IsArrayable } from '../../recipes/IsArrayable';
8
- import { IsLinker } from '../../recipes/IsLinker';
9
- import { Linker } from './Linker';
10
- /**
11
- * LinkedList represents a collection stored as a LinkedList with next references.
12
- * @extends Arrayable
13
- */
14
- export declare class LinkedList implements IsArrayable<Linker>, Iterable<Linker> {
15
- /** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
16
- readonly classType: typeof LinkedList;
17
- /** The first linker of the list (null when the list is empty), from which the whole list is reached. */
18
- innerList: Linker;
19
- /** Whether the inner list has been initialized (it can only be initialized once). */
20
- initialized: boolean;
21
- /** The class used to wrap the data given to this list as linkers. */
22
- linkerClass: typeof Linker;
23
- /** The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet). */
24
- private tailCache;
25
- /** The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet). */
26
- private countCache;
27
- /**
28
- * Create the new LinkedList instance.
29
- * @param {Linker} [linkerClass=Linker] The class used to wrap given data as linkers.
30
- */
31
- constructor(linkerClass?: typeof Linker);
32
- /**
33
- * Initialize the inner list, should only run once.
34
- * @param {Linker|Array} initialList Give the list of linkers to start in this linked-list.
35
- * @return {LinkedList}
36
- */
37
- initialize(initialList: Linker): LinkedList;
38
- /**
39
- * Retrieve the innerList used (the list itself, not a copy).
40
- * @returns {Linker}
41
- */
42
- get list(): IsLinker;
43
- /**
44
- * Retrieve the first Linker in the list.
45
- * @returns {Linker}
46
- */
47
- get first(): Linker;
48
- /**
49
- * Retrieve the last Linker in the list. The end is remembered, so this does not walk the list.
50
- * @returns {Linker}
51
- */
52
- get last(): Linker | null;
53
- /**
54
- * Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
55
- * (call reset() after linkers were changed directly).
56
- * @returns {number}
57
- */
58
- get length(): number;
59
- /**
60
- * Insert a new node (or data) after a node.
61
- * @param {Linker|*} node The existing node as reference, or null to insert at the start of the list
62
- * @param {Linker|*} newNode The new node to go after the existing node
63
- * @returns {LinkedList}
64
- */
65
- insertAfter(node: IsLinker | null, newNode: Linker | any): LinkedList;
66
- /**
67
- * Insert a new node (or data) before a node.
68
- * @param {Linker|*} node The existing node as reference, or null to insert at the end of the list
69
- * @param {Linker|*} newNode The new node to go before the existing node
70
- * @returns {LinkedList}
71
- * @throws {Error} When the reference node is not in this list
72
- */
73
- insertBefore(node: IsLinker | null, newNode: Linker | any): LinkedList;
74
- /**
75
- * Add a node (or data) after the given (or last) node in the list.
76
- * @param {Linker|*} node The new node to add to the end of the list
77
- * @param {Linker} after The existing last node
78
- * @returns {Linker}
79
- */
80
- append(node: Linker | any, after?: IsLinker): LinkedList;
81
- /**
82
- * Add a node (or data) before the given (or first) node in the list.
83
- * @param {Linker|*} node The new node to add to the start of the list
84
- * @param {Linker} before The existing first node
85
- * @returns {Linker}
86
- */
87
- prepend(node: Linker | any, before?: IsLinker): LinkedList;
88
- /**
89
- * Remove a linker from this linked list.
90
- * @param {Linker} node The node we wish to remove (and it will be returned after removal)
91
- * @return {Linker|null} The removed node, or null when it was not in this list (nothing is removed)
92
- */
93
- remove(node: Linker | null): Linker | null;
94
- /**
95
- * Refresh the remembered end and length of the list by walking it once. The list's own methods keep these up to date,
96
- * so this is only needed after linkers were changed directly (for example by setting next on a linker).
97
- * @return {Linker|null} The first linker of the list
98
- */
99
- reset(): Linker | null;
100
- /**
101
- * Retrieve a Linker item from this list by numeric index, otherwise return null.
102
- * @param {number} index The integer number for retrieving a node by position.
103
- * @returns {Linker|null}
104
- */
105
- item(index: number): Linker | null;
106
- /**
107
- * Be able to run forEach on this LinkedList to iterate over the linkers.
108
- * @param {forEachCallback} callback The function to call for-each linker
109
- * @param {LinkedList} thisArg Optional, 'this' reference
110
- * @returns {LinkedList}
111
- */
112
- forEach(callback: forEachCallback, thisArg?: LinkedList): LinkedList;
113
- /**
114
- * Be able to iterate over this class.
115
- * @returns {Iterator}
116
- */
117
- [Symbol.iterator](): Iterator<Linker>;
118
- /**
119
- * Convert an array to a LinkedList.
120
- * @param {Array} values An array of values which will be converted to linkers in this linked-list
121
- * @param {IsLinker} linkerClass The class to use for each linker
122
- * @param {IsArrayable<Linker>} [classType=LinkedList] Provide the type of IsArrayable to use.
123
- * @returns {LinkedList}
124
- */
125
- static fromArray: (values?: Array<any>, linkerClass?: typeof Linker, classType?: any) => IsArrayable<IsLinker> | any;
126
- }
1
+ /**
2
+ * linked list.
3
+ */
4
+ import { forEachCallback, IsArrayable } from '../../recipes/IsArrayable';
5
+ import { IsLinker } from '../../recipes/IsLinker';
6
+ import { Linker } from './Linker';
7
+ /**
8
+ * LinkedList represents a collection stored as a LinkedList with next references.
9
+ * @extends Arrayable
10
+ */
11
+ export declare class LinkedList implements IsArrayable<Linker>, Iterable<Linker> {
12
+ /** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
13
+ readonly classType: typeof LinkedList;
14
+ /** The first linker of the list (null when the list is empty), from which the whole list is reached. */
15
+ innerList: Linker;
16
+ /** Whether the inner list has been initialized (it can only be initialized once). */
17
+ initialized: boolean;
18
+ /** The class used to wrap the data given to this list as linkers. */
19
+ linkerClass: typeof Linker;
20
+ /** The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet). */
21
+ private tailCache;
22
+ /** The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet). */
23
+ private countCache;
24
+ /**
25
+ * Create the new LinkedList instance.
26
+ * @param linkerClass The class used to wrap given data as linkers.
27
+ */
28
+ constructor(linkerClass?: typeof Linker);
29
+ /**
30
+ * Initialize the inner list, should only run once.
31
+ * @param initialList Give the list of linkers to start in this linked-list.
32
+ */
33
+ initialize(initialList: Linker): LinkedList;
34
+ /**
35
+ * Retrieve the innerList used (the list itself, not a copy).
36
+ */
37
+ get list(): IsLinker;
38
+ /**
39
+ * Retrieve the first Linker in the list.
40
+ */
41
+ get first(): Linker;
42
+ /**
43
+ * Retrieve the last Linker in the list. The end is remembered, so this does not walk the list.
44
+ */
45
+ get last(): Linker | null;
46
+ /**
47
+ * Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
48
+ * (call reset() after linkers were changed directly).
49
+ */
50
+ get length(): number;
51
+ /**
52
+ * Insert a new node (or data) after a node.
53
+ * @param node The existing node as reference, or null to insert at the start of the list
54
+ * @param newNode The new node to go after the existing node
55
+ */
56
+ insertAfter(node: IsLinker | null, newNode: Linker | any): LinkedList;
57
+ /**
58
+ * Insert a new node (or data) before a node.
59
+ * @param node The existing node as reference, or null to insert at the end of the list
60
+ * @param newNode The new node to go before the existing node
61
+ * @throws {Error} When the reference node is not in this list
62
+ */
63
+ insertBefore(node: IsLinker | null, newNode: Linker | any): LinkedList;
64
+ /**
65
+ * Add a node (or data) after the given (or last) node in the list.
66
+ * @param node The new node to add to the end of the list
67
+ * @param after The existing last node
68
+ */
69
+ append(node: Linker | any, after?: IsLinker): LinkedList;
70
+ /**
71
+ * Add a node (or data) before the given (or first) node in the list.
72
+ * @param node The new node to add to the start of the list
73
+ * @param before The existing first node
74
+ */
75
+ prepend(node: Linker | any, before?: IsLinker): LinkedList;
76
+ /**
77
+ * Remove a linker from this linked list.
78
+ * @param node The node we wish to remove (and it will be returned after removal)
79
+ * @returns The removed node, or null when it was not in this list (nothing is removed)
80
+ */
81
+ remove(node: Linker | null): Linker | null;
82
+ /**
83
+ * Refresh the remembered end and length of the list by walking it once. The list's own methods keep these up to date,
84
+ * so this is only needed after linkers were changed directly (for example by setting next on a linker).
85
+ * @returns The first linker of the list
86
+ */
87
+ reset(): Linker | null;
88
+ /**
89
+ * Retrieve a Linker item from this list by numeric index, otherwise return null.
90
+ * @param index The integer number for retrieving a node by position.
91
+ */
92
+ item(index: number): Linker | null;
93
+ /**
94
+ * Be able to run forEach on this LinkedList to iterate over the linkers.
95
+ * @param callback The function to call for-each linker
96
+ * @param thisArg Optional, 'this' reference
97
+ */
98
+ forEach(callback: forEachCallback, thisArg?: LinkedList): LinkedList;
99
+ /**
100
+ * Be able to iterate over this class.
101
+ */
102
+ [Symbol.iterator](): Iterator<Linker>;
103
+ /**
104
+ * Convert an array to a LinkedList.
105
+ * @param values An array of values which will be converted to linkers in this linked-list
106
+ * @param linkerClass The class to use for each linker
107
+ * @param classType Provide the type of IsArrayable to use.
108
+ */
109
+ static fromArray: (values?: Array<any>, linkerClass?: typeof Linker, classType?: any) => IsArrayable<IsLinker> | any;
110
+ }