collect-your-stuff 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 (68) hide show
  1. package/README.md +898 -213
  2. package/browser/collect-your-stuff.js +677 -648
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +38 -38
  5. package/dist/collections/arrayable/ArrayElement.js +66 -66
  6. package/dist/collections/arrayable/Arrayable.d.ts +122 -122
  7. package/dist/collections/arrayable/Arrayable.js +2 -2
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +50 -50
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +1 -1
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +125 -125
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +3 -3
  12. package/dist/collections/linked-list/LinkedList.d.ts +126 -126
  13. package/dist/collections/linked-list/LinkedList.js +3 -3
  14. package/dist/collections/linked-list/Linker.d.ts +46 -46
  15. package/dist/collections/linked-list/Linker.js +1 -1
  16. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +159 -159
  17. package/dist/collections/linked-tree-list/LinkedTreeList.js +3 -3
  18. package/dist/collections/linked-tree-list/TreeLinker.d.ts +71 -71
  19. package/dist/collections/linked-tree-list/TreeLinker.js +2 -2
  20. package/dist/collections/queue/Queue.d.ts +59 -59
  21. package/dist/collections/queue/Queue.js +11 -9
  22. package/dist/collections/queue/Queueable.d.ts +83 -83
  23. package/dist/collections/queue/Queueable.js +9 -7
  24. package/dist/collections/queue/TaskQueue.d.ts +68 -68
  25. package/dist/collections/queue/TaskQueue.js +2 -2
  26. package/dist/collections/stack/Stack.d.ts +64 -64
  27. package/dist/collections/stack/Stack.js +11 -9
  28. package/dist/collections/stack/Stackable.d.ts +59 -59
  29. package/dist/collections/stack/Stackable.js +1 -1
  30. package/dist/collections/stack/TaskStack.d.ts +65 -65
  31. package/dist/collections/stack/TaskStack.js +2 -2
  32. package/dist/main.d.ts +68 -68
  33. package/dist/main.js +1 -1
  34. package/dist/recipes/ArrayIterator.d.ts +20 -20
  35. package/dist/recipes/ArrayIterator.js +39 -39
  36. package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
  37. package/dist/recipes/DoubleLinkerIterator.js +33 -33
  38. package/dist/recipes/IsArrayable.d.ts +105 -105
  39. package/dist/recipes/IsArrayable.js +5 -5
  40. package/dist/recipes/IsDoubleLinker.d.ts +14 -14
  41. package/dist/recipes/IsDoubleLinker.js +5 -5
  42. package/dist/recipes/IsElement.d.ts +14 -14
  43. package/dist/recipes/IsElement.js +5 -5
  44. package/dist/recipes/IsLinker.d.ts +10 -10
  45. package/dist/recipes/IsLinker.js +5 -5
  46. package/dist/recipes/IsQueue.d.ts +37 -37
  47. package/dist/recipes/IsQueue.js +5 -5
  48. package/dist/recipes/IsStack.d.ts +36 -36
  49. package/dist/recipes/IsStack.js +5 -5
  50. package/dist/recipes/IsTree.d.ts +11 -11
  51. package/dist/recipes/IsTree.js +5 -5
  52. package/dist/recipes/IsTreeNode.d.ts +29 -29
  53. package/dist/recipes/IsTreeNode.js +5 -5
  54. package/dist/recipes/LinkerIterator.d.ts +18 -18
  55. package/dist/recipes/LinkerIterator.js +33 -33
  56. package/dist/recipes/Runnable.d.ts +55 -55
  57. package/dist/recipes/Runnable.js +69 -69
  58. package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
  59. package/dist/recipes/TreeLinkerIterator.js +1 -1
  60. package/dist/recipes/recipes.d.ts +15 -15
  61. package/dist/recipes/recipes.js +2 -2
  62. package/dist/services/parseTree.d.ts +9 -9
  63. package/dist/services/parseTree.js +1 -1
  64. package/dist/services/parseTreeNext.d.ts +17 -17
  65. package/dist/services/parseTreeNext.js +42 -42
  66. package/dist/services/services.d.ts +13 -13
  67. package/dist/services/services.js +2 -2
  68. package/package.json +2 -2
@@ -1,126 +1,126 @@
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
+ * @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
+ }
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  })
6
6
  exports.LinkedList = void 0
7
- var _Linker = require('./Linker')
8
- var _LinkerIterator = require('../../recipes/LinkerIterator')
9
- var _Arrayable = require('../arrayable/Arrayable')
7
+ const _Linker = require('./Linker')
8
+ const _LinkerIterator = require('../../recipes/LinkerIterator')
9
+ const _Arrayable = require('../arrayable/Arrayable')
10
10
  /**
11
11
  * LinkedList represents a collection stored as a LinkedList with next references.
12
12
  * @extends Arrayable
@@ -1,46 +1,46 @@
1
- /**
2
- * @file linked list item.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.1.0
5
- * @memberOf module:collect-your-stuff
6
- */
7
- import { IsLinker } from '../../recipes/IsLinker';
8
- /**
9
- * Linker represents a node in a LinkedList.
10
- * @extends ArrayElement
11
- */
12
- export declare class Linker implements IsLinker {
13
- /** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
14
- readonly classType: typeof Linker;
15
- /** The data stored in this linker. */
16
- data: any;
17
- /** The linker after this one, or null when this is the last. */
18
- next: Linker | null;
19
- /**
20
- * Create the new Linker instance, provide the data and optionally give the next Linker.
21
- * @param {Object} [nodeData={}] The settings for the new linker.
22
- * @param {*} [nodeData.data=null] The data to be stored in this linker
23
- * @param {Linker|null} [nodeData.next=null] The reference to the next linker if any
24
- */
25
- constructor({ data, next }?: {
26
- data?: any;
27
- next?: Linker | null;
28
- });
29
- /**
30
- * Make a new Linker from the data given if it is not already a valid Linker.
31
- * @param {Linker|*} linker Return a valid Linker instance from given data, or even an already valid one.
32
- * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
33
- * @return {Linker}
34
- */
35
- static make: (linker: Linker | any, classType?: any) => IsLinker | any;
36
- /**
37
- * Convert an array into Linker instances, return the head and tail Linkers.
38
- * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of linkers.
39
- * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
40
- * @returns {{head: Linker, tail: Linker}}
41
- */
42
- static fromArray: (values?: Array<any>, classType?: any) => {
43
- head: IsLinker;
44
- tail: IsLinker;
45
- };
46
- }
1
+ /**
2
+ * @file linked list item.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.1.0
5
+ * @memberOf module:collect-your-stuff
6
+ */
7
+ import { IsLinker } from '../../recipes/IsLinker';
8
+ /**
9
+ * Linker represents a node in a LinkedList.
10
+ * @extends ArrayElement
11
+ */
12
+ export declare class Linker implements IsLinker {
13
+ /** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
14
+ readonly classType: typeof Linker;
15
+ /** The data stored in this linker. */
16
+ data: any;
17
+ /** The linker after this one, or null when this is the last. */
18
+ next: Linker | null;
19
+ /**
20
+ * Create the new Linker instance, provide the data and optionally give the next Linker.
21
+ * @param {Object} [nodeData={}] The settings for the new linker.
22
+ * @param {*} [nodeData.data=null] The data to be stored in this linker
23
+ * @param {Linker|null} [nodeData.next=null] The reference to the next linker if any
24
+ */
25
+ constructor({ data, next }?: {
26
+ data?: any;
27
+ next?: Linker | null;
28
+ });
29
+ /**
30
+ * Make a new Linker from the data given if it is not already a valid Linker.
31
+ * @param {Linker|*} linker Return a valid Linker instance from given data, or even an already valid one.
32
+ * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
33
+ * @return {Linker}
34
+ */
35
+ static make: (linker: Linker | any, classType?: any) => IsLinker | any;
36
+ /**
37
+ * Convert an array into Linker instances, return the head and tail Linkers.
38
+ * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of linkers.
39
+ * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
40
+ * @returns {{head: Linker, tail: Linker}}
41
+ */
42
+ static fromArray: (values?: Array<any>, classType?: any) => {
43
+ head: IsLinker;
44
+ tail: IsLinker;
45
+ };
46
+ }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
6
6
  exports.Linker = void 0
7
7
  require('core-js/modules/esnext.iterator.constructor.js')
8
8
  require('core-js/modules/esnext.iterator.reduce.js')
9
- var _ArrayElement = require('../arrayable/ArrayElement')
9
+ const _ArrayElement = require('../arrayable/ArrayElement')
10
10
  /**
11
11
  * Linker represents a node in a LinkedList.
12
12
  * @extends ArrayElement