collect-your-stuff 1.2.7 → 1.2.8

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 (61) hide show
  1. package/README.md +2525 -2525
  2. package/browser/collect-your-stuff.js +22766 -22761
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +36 -36
  5. package/dist/collections/arrayable/ArrayElement.js +64 -64
  6. package/dist/collections/arrayable/Arrayable.d.ts +108 -108
  7. package/dist/collections/arrayable/Arrayable.js +188 -188
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +46 -46
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +69 -69
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +113 -113
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +274 -269
  12. package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -1
  13. package/dist/collections/linked-list/LinkedList.d.ts +109 -109
  14. package/dist/collections/linked-list/LinkedList.js +233 -233
  15. package/dist/collections/linked-list/Linker.d.ts +43 -43
  16. package/dist/collections/linked-list/Linker.js +80 -80
  17. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +135 -135
  18. package/dist/collections/linked-tree-list/LinkedTreeList.js +252 -252
  19. package/dist/collections/linked-tree-list/TreeLinker.d.ts +63 -63
  20. package/dist/collections/linked-tree-list/TreeLinker.js +79 -79
  21. package/dist/collections/queue/Queue.d.ts +63 -63
  22. package/dist/collections/queue/Queue.js +130 -130
  23. package/dist/collections/queue/Queueable.d.ts +77 -77
  24. package/dist/collections/queue/Queueable.js +141 -141
  25. package/dist/collections/stack/Stack.d.ts +63 -63
  26. package/dist/collections/stack/Stack.js +106 -106
  27. package/dist/collections/stack/Stackable.d.ts +56 -56
  28. package/dist/collections/stack/Stackable.js +83 -83
  29. package/dist/main.d.ts +40 -40
  30. package/dist/main.js +50 -50
  31. package/dist/recipes/ArrayIterator.d.ts +10 -10
  32. package/dist/recipes/ArrayIterator.js +29 -29
  33. package/dist/recipes/DoubleLinkerIterator.d.ts +9 -9
  34. package/dist/recipes/DoubleLinkerIterator.js +24 -24
  35. package/dist/recipes/IsArrayable.d.ts +105 -105
  36. package/dist/recipes/IsArrayable.js +5 -5
  37. package/dist/recipes/IsDoubleLinker.d.ts +14 -14
  38. package/dist/recipes/IsDoubleLinker.js +5 -5
  39. package/dist/recipes/IsElement.d.ts +14 -14
  40. package/dist/recipes/IsElement.js +5 -5
  41. package/dist/recipes/IsLinker.d.ts +10 -10
  42. package/dist/recipes/IsLinker.js +5 -5
  43. package/dist/recipes/IsTree.d.ts +11 -11
  44. package/dist/recipes/IsTree.js +5 -5
  45. package/dist/recipes/IsTreeNode.d.ts +29 -29
  46. package/dist/recipes/IsTreeNode.js +5 -5
  47. package/dist/recipes/LinkerIterator.d.ts +9 -9
  48. package/dist/recipes/LinkerIterator.js +24 -24
  49. package/dist/recipes/Runnable.d.ts +54 -54
  50. package/dist/recipes/Runnable.js +68 -68
  51. package/dist/recipes/TreeLinkerIterator.d.ts +9 -9
  52. package/dist/recipes/TreeLinkerIterator.js +25 -25
  53. package/dist/recipes/recipes.d.ts +15 -15
  54. package/dist/recipes/recipes.js +22 -22
  55. package/dist/services/parseTree.d.ts +9 -9
  56. package/dist/services/parseTree.js +24 -24
  57. package/dist/services/parseTreeNext.d.ts +14 -14
  58. package/dist/services/parseTreeNext.js +47 -47
  59. package/dist/services/services.d.ts +13 -13
  60. package/dist/services/services.js +22 -22
  61. package/package.json +1 -1
@@ -1,80 +1,80 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.Linker = void 0
7
- require('core-js/modules/esnext.iterator.constructor.js')
8
- require('core-js/modules/esnext.iterator.reduce.js')
9
- var _ArrayElement = require('../arrayable/ArrayElement')
10
- /**
11
- * Linker represents a node in a LinkedList.
12
- * @extends ArrayElement
13
- */
14
- class Linker {
15
- /**
16
- * Create the new Linker instance, provide the data and optionally give the next Linker.
17
- * @param {Object} [nodeData={}]
18
- * @param {*} [nodeData.data=null] The data to be stored in this linker
19
- * @param {Linker|null} [nodeData.next=null] The reference to the next linker if any
20
- */
21
- constructor ({
22
- data = null,
23
- next = null
24
- } = {}) {
25
- this.classType = Linker
26
- this.data = null
27
- this.next = null
28
- this.data = data
29
- this.next = next
30
- }
31
- }
32
- /**
33
- * Make a new Linker from the data given if it is not already a valid Linker.
34
- * @param {Linker|*} linker Return a valid Linker instance from given data, or even an already valid one.
35
- * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
36
- * @return {Linker}
37
- */
38
- exports.Linker = Linker
39
- Linker.make = (linker, classType = Linker) => {
40
- if (typeof linker !== 'object') {
41
- // It is not an object, so instantiate the Linker with element as the data
42
- return new classType({
43
- data: linker
44
- })
45
- }
46
- if (linker.classType) {
47
- // Already valid Linker, return as-is
48
- return linker
49
- }
50
- if (!linker.data) {
51
- linker = {
52
- data: linker
53
- }
54
- }
55
- // Create the new node as the configured #classType
56
- return _ArrayElement.ArrayElement.make(linker, classType)
57
- }
58
- /**
59
- * Convert an array into Linker instances, return the head and tail Linkers.
60
- * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of linkers.
61
- * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
62
- * @returns {{head: Linker, tail: Linker}}
63
- */
64
- Linker.fromArray = (values, classType = Linker) => values.reduce((references, linker) => {
65
- const newLinker = classType.make(linker, classType)
66
- if (references.head === null) {
67
- // Initialize the head and tail with the new node
68
- return {
69
- head: newLinker,
70
- tail: newLinker
71
- }
72
- }
73
- // Only update the tail once head has been set, tail is always the most recent node
74
- references.tail.next = newLinker
75
- references.tail = newLinker
76
- return references
77
- }, {
78
- head: null,
79
- tail: null
80
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.Linker = void 0
7
+ require('core-js/modules/esnext.iterator.constructor.js')
8
+ require('core-js/modules/esnext.iterator.reduce.js')
9
+ var _ArrayElement = require('../arrayable/ArrayElement')
10
+ /**
11
+ * Linker represents a node in a LinkedList.
12
+ * @extends ArrayElement
13
+ */
14
+ class Linker {
15
+ /**
16
+ * Create the new Linker instance, provide the data and optionally give the next Linker.
17
+ * @param {Object} [nodeData={}]
18
+ * @param {*} [nodeData.data=null] The data to be stored in this linker
19
+ * @param {Linker|null} [nodeData.next=null] The reference to the next linker if any
20
+ */
21
+ constructor ({
22
+ data = null,
23
+ next = null
24
+ } = {}) {
25
+ this.classType = Linker
26
+ this.data = null
27
+ this.next = null
28
+ this.data = data
29
+ this.next = next
30
+ }
31
+ }
32
+ /**
33
+ * Make a new Linker from the data given if it is not already a valid Linker.
34
+ * @param {Linker|*} linker Return a valid Linker instance from given data, or even an already valid one.
35
+ * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
36
+ * @return {Linker}
37
+ */
38
+ exports.Linker = Linker
39
+ Linker.make = (linker, classType = Linker) => {
40
+ if (typeof linker !== 'object') {
41
+ // It is not an object, so instantiate the Linker with element as the data
42
+ return new classType({
43
+ data: linker
44
+ })
45
+ }
46
+ if (linker.classType) {
47
+ // Already valid Linker, return as-is
48
+ return linker
49
+ }
50
+ if (!linker.data) {
51
+ linker = {
52
+ data: linker
53
+ }
54
+ }
55
+ // Create the new node as the configured #classType
56
+ return _ArrayElement.ArrayElement.make(linker, classType)
57
+ }
58
+ /**
59
+ * Convert an array into Linker instances, return the head and tail Linkers.
60
+ * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of linkers.
61
+ * @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
62
+ * @returns {{head: Linker, tail: Linker}}
63
+ */
64
+ Linker.fromArray = (values, classType = Linker) => values.reduce((references, linker) => {
65
+ const newLinker = classType.make(linker, classType)
66
+ if (references.head === null) {
67
+ // Initialize the head and tail with the new node
68
+ return {
69
+ head: newLinker,
70
+ tail: newLinker
71
+ }
72
+ }
73
+ // Only update the tail once head has been set, tail is always the most recent node
74
+ references.tail.next = newLinker
75
+ references.tail = newLinker
76
+ return references
77
+ }, {
78
+ head: null,
79
+ tail: null
80
+ })
@@ -1,135 +1,135 @@
1
- /**
2
- * @file doubly linked tree list.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.1.0
5
- * @memberOf module:collect-your-stuff
6
- */
7
- import { TreeLinker } from './TreeLinker';
8
- import { forEachCallback } from '../../recipes/IsArrayable';
9
- import { IsTree } from '../../recipes/IsTree';
10
- import { IsTreeNode } from '../../recipes/IsTreeNode';
11
- /**
12
- * LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.
13
- * @extends DoublyLinkedList
14
- */
15
- export declare class LinkedTreeList implements IsTree, Iterable<TreeLinker> {
16
- readonly classType: typeof LinkedTreeList;
17
- innerList: IsTreeNode | any;
18
- initialized: boolean;
19
- linkerClass: typeof TreeLinker;
20
- /**
21
- * Create the new LinkedTreeList instance, configure the list class.
22
- */
23
- constructor(linkerClass?: typeof TreeLinker);
24
- /**
25
- * Initialize the inner list, should only run once.
26
- * @param {TreeLinker} initialList Give the list of tree-linkers to start in this linked-tree-list.
27
- * @return {LinkedTreeList}
28
- */
29
- initialize(initialList: TreeLinker): LinkedTreeList;
30
- /**
31
- * Retrieve a copy of the innerList used.
32
- * @returns {TreeLinker}
33
- */
34
- get list(): TreeLinker;
35
- /**
36
- * Retrieve the first TreeLinker in the list.
37
- * @returns {TreeLinker}
38
- */
39
- get first(): TreeLinker;
40
- /**
41
- * Retrieve the last TreeLinker in the list.
42
- * @returns {TreeLinker}
43
- */
44
- get last(): TreeLinker;
45
- /**
46
- * Return the length of the list.
47
- * @returns {number}
48
- */
49
- get length(): number;
50
- /**
51
- * Get the parent of this tree list.
52
- * @return {TreeLinker}
53
- */
54
- get parent(): TreeLinker;
55
- /**
56
- * Set the parent of this tree list
57
- * @param {TreeLinker} parent The new node to use as the parent for this group of children
58
- */
59
- set parent(parent: TreeLinker);
60
- /**
61
- * Return the root parent of the entire tree.
62
- * @return {TreeLinker}
63
- */
64
- get rootParent(): TreeLinker;
65
- /**
66
- * Set the children on a parent item.
67
- * @param {TreeLinker} item The TreeLinker node that will be the parent of the children
68
- * @param {LinkedTreeList} children The LinkedTreeList which has the child nodes to use
69
- */
70
- setChildren(item: TreeLinker, children?: LinkedTreeList): void;
71
- /**
72
- * Insert a new node (or data) after a node.
73
- * @param {TreeLinker|*} node The existing node as reference
74
- * @param {TreeLinker|*} newNode The new node to go after the existing node
75
- * @returns {LinkedTreeList}
76
- */
77
- insertAfter(node: TreeLinker, newNode: TreeLinker | any): LinkedTreeList;
78
- /**
79
- * Insert a new node (or data) before a node.
80
- * @param {TreeLinker|*} node The existing node as reference
81
- * @param {TreeLinker|*} newNode The new node to go before the existing node
82
- * @returns {LinkedTreeList}
83
- */
84
- insertBefore(node: TreeLinker, newNode: TreeLinker | any): LinkedTreeList;
85
- /**
86
- * Add a node (or data) after the given (or last) node in the list.
87
- * @param {TreeLinker|*} node The new node to add to the end of the list
88
- * @param {TreeLinker} after The existing last node
89
- * @returns {TreeLinker}
90
- */
91
- append(node: TreeLinker | any, after?: TreeLinker): LinkedTreeList;
92
- /**
93
- * Add a node (or data) before the given (or first) node in the list.
94
- * @param {TreeLinker|*} node The new node to add to the start of the list
95
- * @param {TreeLinker} before The existing first node
96
- * @returns {TreeLinker}
97
- */
98
- prepend(node: TreeLinker | any, before?: TreeLinker): LinkedTreeList;
99
- /**
100
- * Remove a linker from this linked list.
101
- * @param {TreeLinker} node The node we wish to remove (and it will be returned after removal)
102
- * @return {TreeLinker}
103
- */
104
- remove(node: TreeLinker): TreeLinker;
105
- /**
106
- * Refresh all references and return head reference.
107
- * @return {TreeLinker}
108
- */
109
- reset(): TreeLinker;
110
- /**
111
- * Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
112
- * @param {number} index The integer number for retrieving a node by position.
113
- * @returns {TreeLinker|null}
114
- */
115
- item(index: number): TreeLinker;
116
- /**
117
- * Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
118
- * @param {forEachCallback} callback The function to call for-each tree node
119
- * @param {LinkedTreeList} thisArg Optional, 'this' reference
120
- */
121
- forEach(callback: forEachCallback, thisArg?: LinkedTreeList): LinkedTreeList;
122
- /**
123
- * Be able to iterate over this class.
124
- * @returns {Iterator}
125
- */
126
- [Symbol.iterator](): Iterator<TreeLinker>;
127
- /**
128
- * Convert an array into a LinkedTreeList instance, return the new instance.
129
- * @param {Array} [values=[]] An array of values which will be converted to nodes in this tree-list
130
- * @param {TreeLinker} [linkerClass=TreeLinker] The class to use for each node
131
- * @param {IsArrayable<TreeLinker>} [classType=LinkedTreeList] Provide the type of IsArrayable to use.
132
- * @returns {LinkedTreeList}
133
- */
134
- static fromArray: (values?: Array<any>, linkerClass?: typeof TreeLinker, classType?: any) => IsTree | any;
135
- }
1
+ /**
2
+ * @file doubly linked tree list.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.1.0
5
+ * @memberOf module:collect-your-stuff
6
+ */
7
+ import { TreeLinker } from './TreeLinker';
8
+ import { forEachCallback } from '../../recipes/IsArrayable';
9
+ import { IsTree } from '../../recipes/IsTree';
10
+ import { IsTreeNode } from '../../recipes/IsTreeNode';
11
+ /**
12
+ * LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.
13
+ * @extends DoublyLinkedList
14
+ */
15
+ export declare class LinkedTreeList implements IsTree, Iterable<TreeLinker> {
16
+ readonly classType: typeof LinkedTreeList;
17
+ innerList: IsTreeNode | any;
18
+ initialized: boolean;
19
+ linkerClass: typeof TreeLinker;
20
+ /**
21
+ * Create the new LinkedTreeList instance, configure the list class.
22
+ */
23
+ constructor(linkerClass?: typeof TreeLinker);
24
+ /**
25
+ * Initialize the inner list, should only run once.
26
+ * @param {TreeLinker} initialList Give the list of tree-linkers to start in this linked-tree-list.
27
+ * @return {LinkedTreeList}
28
+ */
29
+ initialize(initialList: TreeLinker): LinkedTreeList;
30
+ /**
31
+ * Retrieve a copy of the innerList used.
32
+ * @returns {TreeLinker}
33
+ */
34
+ get list(): TreeLinker;
35
+ /**
36
+ * Retrieve the first TreeLinker in the list.
37
+ * @returns {TreeLinker}
38
+ */
39
+ get first(): TreeLinker;
40
+ /**
41
+ * Retrieve the last TreeLinker in the list.
42
+ * @returns {TreeLinker}
43
+ */
44
+ get last(): TreeLinker;
45
+ /**
46
+ * Return the length of the list.
47
+ * @returns {number}
48
+ */
49
+ get length(): number;
50
+ /**
51
+ * Get the parent of this tree list.
52
+ * @return {TreeLinker}
53
+ */
54
+ get parent(): TreeLinker;
55
+ /**
56
+ * Set the parent of this tree list
57
+ * @param {TreeLinker} parent The new node to use as the parent for this group of children
58
+ */
59
+ set parent(parent: TreeLinker);
60
+ /**
61
+ * Return the root parent of the entire tree.
62
+ * @return {TreeLinker}
63
+ */
64
+ get rootParent(): TreeLinker;
65
+ /**
66
+ * Set the children on a parent item.
67
+ * @param {TreeLinker} item The TreeLinker node that will be the parent of the children
68
+ * @param {LinkedTreeList} children The LinkedTreeList which has the child nodes to use
69
+ */
70
+ setChildren(item: TreeLinker, children?: LinkedTreeList): void;
71
+ /**
72
+ * Insert a new node (or data) after a node.
73
+ * @param {TreeLinker|*} node The existing node as reference
74
+ * @param {TreeLinker|*} newNode The new node to go after the existing node
75
+ * @returns {LinkedTreeList}
76
+ */
77
+ insertAfter(node: TreeLinker, newNode: TreeLinker | any): LinkedTreeList;
78
+ /**
79
+ * Insert a new node (or data) before a node.
80
+ * @param {TreeLinker|*} node The existing node as reference
81
+ * @param {TreeLinker|*} newNode The new node to go before the existing node
82
+ * @returns {LinkedTreeList}
83
+ */
84
+ insertBefore(node: TreeLinker, newNode: TreeLinker | any): LinkedTreeList;
85
+ /**
86
+ * Add a node (or data) after the given (or last) node in the list.
87
+ * @param {TreeLinker|*} node The new node to add to the end of the list
88
+ * @param {TreeLinker} after The existing last node
89
+ * @returns {TreeLinker}
90
+ */
91
+ append(node: TreeLinker | any, after?: TreeLinker): LinkedTreeList;
92
+ /**
93
+ * Add a node (or data) before the given (or first) node in the list.
94
+ * @param {TreeLinker|*} node The new node to add to the start of the list
95
+ * @param {TreeLinker} before The existing first node
96
+ * @returns {TreeLinker}
97
+ */
98
+ prepend(node: TreeLinker | any, before?: TreeLinker): LinkedTreeList;
99
+ /**
100
+ * Remove a linker from this linked list.
101
+ * @param {TreeLinker} node The node we wish to remove (and it will be returned after removal)
102
+ * @return {TreeLinker}
103
+ */
104
+ remove(node: TreeLinker): TreeLinker;
105
+ /**
106
+ * Refresh all references and return head reference.
107
+ * @return {TreeLinker}
108
+ */
109
+ reset(): TreeLinker;
110
+ /**
111
+ * Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
112
+ * @param {number} index The integer number for retrieving a node by position.
113
+ * @returns {TreeLinker|null}
114
+ */
115
+ item(index: number): TreeLinker;
116
+ /**
117
+ * Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
118
+ * @param {forEachCallback} callback The function to call for-each tree node
119
+ * @param {LinkedTreeList} thisArg Optional, 'this' reference
120
+ */
121
+ forEach(callback: forEachCallback, thisArg?: LinkedTreeList): LinkedTreeList;
122
+ /**
123
+ * Be able to iterate over this class.
124
+ * @returns {Iterator}
125
+ */
126
+ [Symbol.iterator](): Iterator<TreeLinker>;
127
+ /**
128
+ * Convert an array into a LinkedTreeList instance, return the new instance.
129
+ * @param {Array} [values=[]] An array of values which will be converted to nodes in this tree-list
130
+ * @param {TreeLinker} [linkerClass=TreeLinker] The class to use for each node
131
+ * @param {IsArrayable<TreeLinker>} [classType=LinkedTreeList] Provide the type of IsArrayable to use.
132
+ * @returns {LinkedTreeList}
133
+ */
134
+ static fromArray: (values?: Array<any>, linkerClass?: typeof TreeLinker, classType?: any) => IsTree | any;
135
+ }