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.
- package/README.md +32 -3241
- package/browser/collect-your-stuff.js +1585 -1193
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
- package/dist/collections/arrayable/ArrayElement.js +64 -66
- package/dist/collections/arrayable/Arrayable.d.ts +107 -122
- package/dist/collections/arrayable/Arrayable.js +208 -223
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
- package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
- package/dist/collections/linked-list/LinkedList.d.ts +110 -126
- package/dist/collections/linked-list/LinkedList.js +283 -296
- package/dist/collections/linked-list/Linker.d.ts +41 -46
- package/dist/collections/linked-list/Linker.js +82 -84
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
- package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
- package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
- package/dist/collections/queue/Queue.d.ts +55 -59
- package/dist/collections/queue/Queue.js +114 -119
- package/dist/collections/queue/Queueable.d.ts +74 -83
- package/dist/collections/queue/Queueable.js +142 -146
- package/dist/collections/queue/TaskQueue.d.ts +59 -68
- package/dist/collections/queue/TaskQueue.js +128 -137
- package/dist/collections/scoped-collection/ScopedCollection.d.ts +42 -0
- package/dist/collections/scoped-collection/ScopedCollection.js +81 -0
- package/dist/collections/scoped-collection/ScopedCollection.min.js +1 -0
- package/dist/collections/stack/Stack.d.ts +60 -64
- package/dist/collections/stack/Stack.js +122 -127
- package/dist/collections/stack/Stackable.d.ts +52 -59
- package/dist/collections/stack/Stackable.js +81 -85
- package/dist/collections/stack/TaskStack.d.ts +56 -65
- package/dist/collections/stack/TaskStack.js +98 -107
- package/dist/main.d.ts +4 -5
- package/dist/main.js +9 -5
- package/dist/main.min.js +1 -1
- package/dist/recipes/ArrayIterator.d.ts +20 -20
- package/dist/recipes/ArrayIterator.js +39 -39
- package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
- package/dist/recipes/DoubleLinkerIterator.js +33 -33
- package/dist/recipes/IsArrayable.d.ts +85 -105
- package/dist/recipes/IsArrayable.js +5 -5
- package/dist/recipes/IsDoubleLinker.d.ts +14 -14
- package/dist/recipes/IsDoubleLinker.js +5 -5
- package/dist/recipes/IsElement.d.ts +14 -14
- package/dist/recipes/IsElement.js +5 -5
- package/dist/recipes/IsLinker.d.ts +10 -10
- package/dist/recipes/IsLinker.js +5 -5
- package/dist/recipes/IsQueue.d.ts +32 -37
- package/dist/recipes/IsQueue.js +5 -5
- package/dist/recipes/IsScopedCollection.d.ts +27 -0
- package/dist/recipes/IsScopedCollection.js +5 -0
- package/dist/recipes/IsScopedCollection.min.js +1 -0
- package/dist/recipes/IsStack.d.ts +31 -36
- package/dist/recipes/IsStack.js +5 -5
- package/dist/recipes/IsTree.d.ts +11 -11
- package/dist/recipes/IsTree.js +5 -5
- package/dist/recipes/IsTreeNode.d.ts +29 -29
- package/dist/recipes/IsTreeNode.js +5 -5
- package/dist/recipes/LinkerIterator.d.ts +18 -18
- package/dist/recipes/LinkerIterator.js +33 -33
- package/dist/recipes/Runnable.d.ts +42 -55
- package/dist/recipes/Runnable.js +63 -69
- package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
- package/dist/recipes/TreeLinkerIterator.js +36 -36
- package/dist/recipes/recipes.d.ts +12 -15
- package/dist/recipes/recipes.js +19 -22
- package/dist/services/parseTree.d.ts +8 -9
- package/dist/services/parseTree.js +23 -24
- package/dist/services/parseTreeNext.d.ts +16 -17
- package/dist/services/parseTreeNext.js +41 -42
- package/dist/services/services.d.ts +10 -13
- package/dist/services/services.js +19 -22
- package/package.json +4 -4
|
@@ -1,126 +1,110 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve the
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @param
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
+
}
|