collect-your-stuff 2.1.2 → 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 (63) hide show
  1. package/README.md +32 -3926
  2. package/browser/collect-your-stuff.js +912 -549
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +6 -11
  5. package/dist/collections/arrayable/ArrayElement.js +5 -7
  6. package/dist/collections/arrayable/Arrayable.d.ts +22 -37
  7. package/dist/collections/arrayable/Arrayable.js +208 -223
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +9 -14
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +19 -36
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
  12. package/dist/collections/linked-list/LinkedList.d.ts +20 -36
  13. package/dist/collections/linked-list/LinkedList.js +283 -296
  14. package/dist/collections/linked-list/Linker.d.ts +8 -13
  15. package/dist/collections/linked-list/Linker.js +82 -84
  16. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +24 -43
  17. package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
  18. package/dist/collections/linked-tree-list/TreeLinker.d.ts +14 -20
  19. package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
  20. package/dist/collections/queue/Queue.d.ts +10 -14
  21. package/dist/collections/queue/Queue.js +114 -121
  22. package/dist/collections/queue/Queueable.d.ts +13 -22
  23. package/dist/collections/queue/Queueable.js +142 -148
  24. package/dist/collections/queue/TaskQueue.d.ts +8 -17
  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 +11 -15
  30. package/dist/collections/stack/Stack.js +122 -129
  31. package/dist/collections/stack/Stackable.d.ts +9 -16
  32. package/dist/collections/stack/Stackable.js +81 -85
  33. package/dist/collections/stack/TaskStack.d.ts +8 -17
  34. package/dist/collections/stack/TaskStack.js +98 -107
  35. package/dist/main.d.ts +67 -68
  36. package/dist/main.js +8 -4
  37. package/dist/main.min.js +1 -1
  38. package/dist/recipes/ArrayIterator.d.ts +4 -4
  39. package/dist/recipes/ArrayIterator.js +4 -4
  40. package/dist/recipes/DoubleLinkerIterator.d.ts +3 -3
  41. package/dist/recipes/DoubleLinkerIterator.js +3 -3
  42. package/dist/recipes/IsArrayable.d.ts +13 -33
  43. package/dist/recipes/IsQueue.d.ts +4 -9
  44. package/dist/recipes/IsScopedCollection.d.ts +27 -0
  45. package/dist/recipes/IsScopedCollection.js +5 -0
  46. package/dist/recipes/IsScopedCollection.min.js +1 -0
  47. package/dist/recipes/IsStack.d.ts +4 -9
  48. package/dist/recipes/IsTreeNode.d.ts +1 -1
  49. package/dist/recipes/LinkerIterator.d.ts +3 -3
  50. package/dist/recipes/LinkerIterator.js +3 -3
  51. package/dist/recipes/Runnable.d.ts +3 -16
  52. package/dist/recipes/Runnable.js +3 -9
  53. package/dist/recipes/TreeLinkerIterator.d.ts +4 -4
  54. package/dist/recipes/TreeLinkerIterator.js +36 -36
  55. package/dist/recipes/recipes.d.ts +1 -4
  56. package/dist/recipes/recipes.js +19 -22
  57. package/dist/services/parseTree.d.ts +2 -3
  58. package/dist/services/parseTree.js +23 -24
  59. package/dist/services/parseTreeNext.d.ts +2 -3
  60. package/dist/services/parseTreeNext.js +2 -3
  61. package/dist/services/services.d.ts +1 -4
  62. package/dist/services/services.js +19 -22
  63. package/package.json +4 -4
@@ -1,85 +1,81 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.Stackable = void 0
7
- const _Linker = require('../linked-list/Linker')
8
- /**
9
- * Stackable represents a runnable entry in stack.
10
- * @extends Linker
11
- */
12
- class Stackable {
13
- /**
14
- * Create a stackable item that can be used in a stack.
15
- * @param {Object} [stackData={}] The settings for the new stackable.
16
- * @param {*} [stackData.task=null] The data to be stored in this stackable
17
- * @param {Stackable|null} [stackData.next=null] The reference to the next stackable if any
18
- * @param {boolean|Function} [stackData.ready=false] Indicate if the stackable is ready to run
19
- */
20
- constructor ({
21
- task = null,
22
- next = null,
23
- ready = false
24
- } = {}) {
25
- /** The task (or data) this stackable holds. */
26
- this.data = null
27
- /** The stackable below this one, or null when this is the bottom. */
28
- this.next = null
29
- this.classType = Stackable
30
- this.data = task
31
- this.next = next
32
- }
33
-
34
- /**
35
- * Retrieve the data which should be formed as a task.
36
- * @return {*}
37
- */
38
- get task () {
39
- if (typeof this.data === 'function') {
40
- return this.data
41
- }
42
- return () => this.data
43
- }
44
-
45
- /**
46
- * Run the stacked task.
47
- * @return {*}
48
- */
49
- run () {
50
- return this.task()
51
- }
52
- }
53
- /**
54
- * Make a new Stackable from the data given if it is not already a valid Stackable.
55
- * @param {Stackable|*} stackable Return a valid Stackable instance from given data, or even an already valid one.
56
- * @param {IsLinker} [classType=Stackable] Provide the type of IsLinker to use.
57
- * @return {Stackable}
58
- */
59
- exports.Stackable = Stackable
60
- Stackable.make = (stackable, classType = Stackable) => {
61
- if (stackable === null || typeof stackable !== 'object') {
62
- // It is not an object (or it is null), so instantiate the Stackable with stackable as the data
63
- return new classType({
64
- task: stackable
65
- })
66
- }
67
- if (stackable.classType) {
68
- // Already valid Stackable, return as-is
69
- return stackable
70
- }
71
- if (!('task' in stackable)) {
72
- stackable = {
73
- task: stackable
74
- }
75
- }
76
- // Create the new node as the configured stackableClass
77
- return new classType(stackable)
78
- }
79
- /**
80
- * Convert an array into Stackable instances, return the head and tail Stackables.
81
- * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of stackable linkers.
82
- * @param {IsLinker} [classType=Stackable] Provide the type of IsLinker to use.
83
- * @returns {{head: Stackable, tail: Stackable}}
84
- */
85
- Stackable.fromArray = (values = [], classType = Stackable) => _Linker.Linker.fromArray(values, classType)
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.Stackable = void 0
7
+ const _Linker = require('../linked-list/Linker')
8
+ /**
9
+ * Stackable represents a runnable entry in stack.
10
+ * @extends Linker
11
+ */
12
+ class Stackable {
13
+ /**
14
+ * Create a stackable item that can be used in a stack.
15
+ * @param stackData The settings for the new stackable.
16
+ * @param stackData.task The data to be stored in this stackable
17
+ * @param stackData.next The reference to the next stackable if any
18
+ * @param stackData.ready Indicate if the stackable is ready to run
19
+ */
20
+ constructor ({
21
+ task = null,
22
+ next = null,
23
+ ready = false
24
+ } = {}) {
25
+ /** The task (or data) this stackable holds. */
26
+ this.data = null
27
+ /** The stackable below this one, or null when this is the bottom. */
28
+ this.next = null
29
+ this.classType = Stackable
30
+ this.data = task
31
+ this.next = next
32
+ }
33
+
34
+ /**
35
+ * Retrieve the data which should be formed as a task.
36
+ */
37
+ get task () {
38
+ if (typeof this.data === 'function') {
39
+ return this.data
40
+ }
41
+ return () => this.data
42
+ }
43
+
44
+ /**
45
+ * Run the stacked task.
46
+ */
47
+ run () {
48
+ return this.task()
49
+ }
50
+ }
51
+ /**
52
+ * Make a new Stackable from the data given if it is not already a valid Stackable.
53
+ * @param stackable Return a valid Stackable instance from given data, or even an already valid one.
54
+ * @param classType Provide the type of IsLinker to use.
55
+ */
56
+ exports.Stackable = Stackable
57
+ Stackable.make = (stackable, classType = Stackable) => {
58
+ if (stackable === null || typeof stackable !== 'object') {
59
+ // It is not an object (or it is null), so instantiate the Stackable with stackable as the data
60
+ return new classType({
61
+ task: stackable
62
+ })
63
+ }
64
+ if (stackable.classType) {
65
+ // Already valid Stackable, return as-is
66
+ return stackable
67
+ }
68
+ if (!('task' in stackable)) {
69
+ stackable = {
70
+ task: stackable
71
+ }
72
+ }
73
+ // Create the new node as the configured stackableClass
74
+ return new classType(stackable)
75
+ }
76
+ /**
77
+ * Convert an array into Stackable instances, return the head and tail Stackables.
78
+ * @param values Provide an array of data that will be converted to a chain of stackable linkers.
79
+ * @param classType Provide the type of IsLinker to use.
80
+ */
81
+ Stackable.fromArray = (values = [], classType = Stackable) => _Linker.Linker.fromArray(values, classType)
@@ -1,8 +1,5 @@
1
1
  /**
2
- * @file task stack.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- * @memberOf module:collect-your-stuff
2
+ * task stack.
6
3
  */
7
4
  import { Stackable } from './Stackable';
8
5
  import { IsArrayable } from '../../recipes/IsArrayable';
@@ -19,47 +16,41 @@ export declare class TaskStack {
19
16
  private stackableClass;
20
17
  /**
21
18
  * Instantiate the state with the starter stacked list.
22
- * @param {Iterable|LinkedList} [stackedList=null] The list of stackables to start in this stack.
23
- * @param {IsArrayable} [listClass=LinkedList] The type of list to create when no stacked list is given.
24
- * @param {Stackable} [stackableClass=Stackable] The class used to wrap stacked items.
19
+ * @param stackedList The list of stackables to start in this stack.
20
+ * @param listClass The type of list to create when no stacked list is given.
21
+ * @param stackableClass The class used to wrap stacked items.
25
22
  */
26
23
  constructor(stackedList?: IsArrayable<any>, listClass?: any, stackableClass?: typeof Stackable);
27
24
  /**
28
25
  * Return true if the stack is empty (there are no tasks in the stacked list)
29
- * @return {boolean}
30
26
  */
31
27
  empty(): boolean;
32
28
  /**
33
29
  * Take a look at the next stacked task
34
- * @return {Stackable}
35
30
  */
36
31
  top(): IsLinker;
37
32
  /**
38
33
  * Remove the next stacked task and return it.
39
- * @return {Stackable|null}
40
34
  */
41
35
  pop(): Stackable | completeResponse | null;
42
36
  /**
43
37
  * Push a stackable task to the top of the stack.
44
- * @param {Stackable|*} stackable Add a new stackable to the top of the stack
38
+ * @param stackable Add a new stackable to the top of the stack
45
39
  */
46
40
  push(stackable: any): void;
47
41
  /**
48
42
  * Remove the next stacked task and return it.
49
- * @return {Stackable|null}
50
43
  */
51
44
  remove(): Stackable | null;
52
45
  /**
53
46
  * Get the size of the current stack.
54
- * @return {number}
55
47
  */
56
48
  size(): number;
57
49
  /**
58
50
  * Convert an array to a TaskStack.
59
- * @param {Array} values An array of values which will be converted to stackables in this queue
60
- * @param {Stackable} stackableClass The class to use for each stackable
61
- * @param {TaskStack|Iterable} listClass The class to use to manage the stackables
62
- * @returns {TaskStack}
51
+ * @param values An array of values which will be converted to stackables in this queue
52
+ * @param stackableClass The class to use for each stackable
53
+ * @param listClass The class to use to manage the stackables
63
54
  */
64
55
  static fromArray: (values?: Array<any>, stackableClass?: typeof Stackable, listClass?: any) => TaskStack;
65
56
  }
@@ -1,107 +1,98 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.TaskStack = void 0
7
- const _Stackable = require('./Stackable')
8
- const _LinkedList = require('../linked-list/LinkedList')
9
- /**
10
- * @file task stack.
11
- * @author Joshua Heagle <joshuaheagle@gmail.com>
12
- * @version 1.0.0
13
- * @memberOf module:collect-your-stuff
14
- */
15
-
16
- /**
17
- * Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
18
- * the top and RUNS it. For a plain last-in-first-out collection of items use Stack.
19
- */
20
- class TaskStack {
21
- /**
22
- * Instantiate the state with the starter stacked list.
23
- * @param {Iterable|LinkedList} [stackedList=null] The list of stackables to start in this stack.
24
- * @param {IsArrayable} [listClass=LinkedList] The type of list to create when no stacked list is given.
25
- * @param {Stackable} [stackableClass=Stackable] The class used to wrap stacked items.
26
- */
27
- constructor (stackedList = null, listClass = _LinkedList.LinkedList, stackableClass = _Stackable.Stackable) {
28
- this.listClass = listClass
29
- this.stackableClass = stackableClass
30
- if (stackedList === null) {
31
- stackedList = new listClass(stackableClass)
32
- }
33
- this.stackedList = stackedList
34
- }
35
-
36
- /**
37
- * Return true if the stack is empty (there are no tasks in the stacked list)
38
- * @return {boolean}
39
- */
40
- empty () {
41
- return this.size() <= 0
42
- }
43
-
44
- /**
45
- * Take a look at the next stacked task
46
- * @return {Stackable}
47
- */
48
- top () {
49
- return this.stackedList.first
50
- }
51
-
52
- /**
53
- * Remove the next stacked task and return it.
54
- * @return {Stackable|null}
55
- */
56
- pop () {
57
- const next = this.remove()
58
- if (!next) {
59
- return {
60
- success: 'No more stackable tasks in the stack',
61
- error: false,
62
- context: this.stackedList
63
- }
64
- }
65
- return next.run()
66
- }
67
-
68
- /**
69
- * Push a stackable task to the top of the stack.
70
- * @param {Stackable|*} stackable Add a new stackable to the top of the stack
71
- */
72
- push (stackable) {
73
- this.stackedList.prepend(stackable)
74
- }
75
-
76
- /**
77
- * Remove the next stacked task and return it.
78
- * @return {Stackable|null}
79
- */
80
- remove () {
81
- if (this.empty()) {
82
- return null
83
- }
84
- return this.stackedList.remove(this.stackedList.first)
85
- }
86
-
87
- /**
88
- * Get the size of the current stack.
89
- * @return {number}
90
- */
91
- size () {
92
- return this.stackedList.length
93
- }
94
- }
95
- /**
96
- * Convert an array to a TaskStack.
97
- * @param {Array} values An array of values which will be converted to stackables in this queue
98
- * @param {Stackable} stackableClass The class to use for each stackable
99
- * @param {TaskStack|Iterable} listClass The class to use to manage the stackables
100
- * @returns {TaskStack}
101
- */
102
- exports.TaskStack = TaskStack
103
- TaskStack.fromArray = (values = [], stackableClass = _Stackable.Stackable, listClass = _LinkedList.LinkedList) => {
104
- const list = new listClass(stackableClass)
105
- list.initialize(stackableClass.fromArray(values, stackableClass).head)
106
- return new TaskStack(list, listClass, stackableClass)
107
- }
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.TaskStack = void 0
7
+ const _Stackable = require('./Stackable')
8
+ const _LinkedList = require('../linked-list/LinkedList')
9
+ /**
10
+ * task stack.
11
+ */
12
+
13
+ /**
14
+ * Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
15
+ * the top and RUNS it. For a plain last-in-first-out collection of items use Stack.
16
+ */
17
+ class TaskStack {
18
+ /**
19
+ * Instantiate the state with the starter stacked list.
20
+ * @param stackedList The list of stackables to start in this stack.
21
+ * @param listClass The type of list to create when no stacked list is given.
22
+ * @param stackableClass The class used to wrap stacked items.
23
+ */
24
+ constructor (stackedList = null, listClass = _LinkedList.LinkedList, stackableClass = _Stackable.Stackable) {
25
+ this.listClass = listClass
26
+ this.stackableClass = stackableClass
27
+ if (stackedList === null) {
28
+ stackedList = new listClass(stackableClass)
29
+ }
30
+ this.stackedList = stackedList
31
+ }
32
+
33
+ /**
34
+ * Return true if the stack is empty (there are no tasks in the stacked list)
35
+ */
36
+ empty () {
37
+ return this.size() <= 0
38
+ }
39
+
40
+ /**
41
+ * Take a look at the next stacked task
42
+ */
43
+ top () {
44
+ return this.stackedList.first
45
+ }
46
+
47
+ /**
48
+ * Remove the next stacked task and return it.
49
+ */
50
+ pop () {
51
+ const next = this.remove()
52
+ if (!next) {
53
+ return {
54
+ success: 'No more stackable tasks in the stack',
55
+ error: false,
56
+ context: this.stackedList
57
+ }
58
+ }
59
+ return next.run()
60
+ }
61
+
62
+ /**
63
+ * Push a stackable task to the top of the stack.
64
+ * @param stackable Add a new stackable to the top of the stack
65
+ */
66
+ push (stackable) {
67
+ this.stackedList.prepend(stackable)
68
+ }
69
+
70
+ /**
71
+ * Remove the next stacked task and return it.
72
+ */
73
+ remove () {
74
+ if (this.empty()) {
75
+ return null
76
+ }
77
+ return this.stackedList.remove(this.stackedList.first)
78
+ }
79
+
80
+ /**
81
+ * Get the size of the current stack.
82
+ */
83
+ size () {
84
+ return this.stackedList.length
85
+ }
86
+ }
87
+ /**
88
+ * Convert an array to a TaskStack.
89
+ * @param values An array of values which will be converted to stackables in this queue
90
+ * @param stackableClass The class to use for each stackable
91
+ * @param listClass The class to use to manage the stackables
92
+ */
93
+ exports.TaskStack = TaskStack
94
+ TaskStack.fromArray = (values = [], stackableClass = _Stackable.Stackable, listClass = _LinkedList.LinkedList) => {
95
+ const list = new listClass(stackableClass)
96
+ list.initialize(stackableClass.fromArray(values, stackableClass).head)
97
+ return new TaskStack(list, listClass, stackableClass)
98
+ }
package/dist/main.d.ts CHANGED
@@ -1,68 +1,67 @@
1
- /**
2
- * All of the collections available.
3
- * @file
4
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5
- * @version 1.0.0
6
- * @module collect-your-stuff
7
- */
8
- import { ArrayElement } from './collections/arrayable/ArrayElement';
9
- import { Arrayable } from './collections/arrayable/Arrayable';
10
- import { DoubleLinker } from './collections/doubly-linked-list/DoubleLinker';
11
- import { DoublyLinkedList } from './collections/doubly-linked-list/DoublyLinkedList';
12
- import { Linker } from './collections/linked-list/Linker';
13
- import { LinkedList } from './collections/linked-list/LinkedList';
14
- import { TreeLinker } from './collections/linked-tree-list/TreeLinker';
15
- import { LinkedTreeList } from './collections/linked-tree-list/LinkedTreeList';
16
- import { Queueable } from './collections/queue/Queueable';
17
- import { Queue } from './collections/queue/Queue';
18
- import { TaskQueue } from './collections/queue/TaskQueue';
19
- import { Stackable } from './collections/stack/Stackable';
20
- import { Stack } from './collections/stack/Stack';
21
- import { TaskStack } from './collections/stack/TaskStack';
22
- import { recipes } from './recipes/recipes';
23
- import { services } from './services/services';
24
- /**
25
- * TODO:
26
- * 1. Create binary tree. Use the tree, but it has a limit of only two children per parent, and when adding / removing sort is applied. Add sort function in fromArray
27
- * 2. Create a heap (both min and max heap variants) which is similar to binary tree in structure, but tree having its min / max value as root. and it must insert on the left-most lowest level, and removes from root. Be able to easily swap nodes to ensure min / max ordering.
28
- * 3. Create a graph type which can have directional and undirectional variants for linking nodes
29
- */
30
- export { ArrayElement, Arrayable, DoubleLinker, DoublyLinkedList, Linker, LinkedList, TreeLinker, LinkedTreeList, Queueable, Queue, TaskQueue, Stackable, Stack, TaskStack, recipes, services };
31
- export type { IsArrayable, forEachCallback } from './recipes/IsArrayable';
32
- export type { IsDoubleLinker } from './recipes/IsDoubleLinker';
33
- export type { IsElement } from './recipes/IsElement';
34
- export type { IsLinker } from './recipes/IsLinker';
35
- export type { IsTree } from './recipes/IsTree';
36
- export type { IsTreeNode } from './recipes/IsTreeNode';
37
- export type { IsQueue } from './recipes/IsQueue';
38
- export type { IsStack } from './recipes/IsStack';
39
- export type { IsRunnable, completeResponse } from './recipes/Runnable';
40
- /**
41
- * All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
42
- * set of classes as the named exports).
43
- */
44
- declare const collectYourStuff: {
45
- ArrayElement: typeof ArrayElement;
46
- Arrayable: typeof Arrayable;
47
- DoubleLinker: typeof DoubleLinker;
48
- DoublyLinkedList: typeof DoublyLinkedList;
49
- Linker: typeof Linker;
50
- LinkedList: typeof LinkedList;
51
- TreeLinker: typeof TreeLinker;
52
- LinkedTreeList: typeof LinkedTreeList;
53
- Queueable: typeof Queueable;
54
- Queue: typeof Queue;
55
- TaskQueue: typeof TaskQueue;
56
- Stackable: typeof Stackable;
57
- Stack: typeof Stack;
58
- TaskStack: typeof TaskStack;
59
- recipes: {
60
- ArrayIterator: typeof import("./recipes/ArrayIterator").ArrayIterator;
61
- Runnable: typeof import("./recipes/Runnable").Runnable;
62
- };
63
- services: {
64
- parseTree: (tree: import("./main").IsTree, callback: import("./main").forEachCallback) => import("./main").IsTree;
65
- parseTreeNext: (treeNode: import("./main").IsTreeNode, boundaryParent?: import("./main").IsTreeNode | null) => import("./main").IsTreeNode | null;
66
- };
67
- };
68
- export default collectYourStuff;
1
+ /**
2
+ * All of the collections available.
3
+ */
4
+ import { ArrayElement } from './collections/arrayable/ArrayElement';
5
+ import { Arrayable } from './collections/arrayable/Arrayable';
6
+ import { DoubleLinker } from './collections/doubly-linked-list/DoubleLinker';
7
+ import { DoublyLinkedList } from './collections/doubly-linked-list/DoublyLinkedList';
8
+ import { Linker } from './collections/linked-list/Linker';
9
+ import { LinkedList } from './collections/linked-list/LinkedList';
10
+ import { TreeLinker } from './collections/linked-tree-list/TreeLinker';
11
+ import { LinkedTreeList } from './collections/linked-tree-list/LinkedTreeList';
12
+ import { Queueable } from './collections/queue/Queueable';
13
+ import { Queue } from './collections/queue/Queue';
14
+ import { TaskQueue } from './collections/queue/TaskQueue';
15
+ import { ScopedCollection } from './collections/scoped-collection/ScopedCollection';
16
+ import { Stackable } from './collections/stack/Stackable';
17
+ import { Stack } from './collections/stack/Stack';
18
+ import { TaskStack } from './collections/stack/TaskStack';
19
+ import { recipes } from './recipes/recipes';
20
+ import { services } from './services/services';
21
+ /**
22
+ * TODO:
23
+ * 1. Create binary tree. Use the tree, but it has a limit of only two children per parent, and when adding / removing sort is applied. Add sort function in fromArray
24
+ * 2. Create a heap (both min and max heap variants) which is similar to binary tree in structure, but tree having its min / max value as root. and it must insert on the left-most lowest level, and removes from root. Be able to easily swap nodes to ensure min / max ordering.
25
+ * 3. Create a graph type which can have directional and undirectional variants for linking nodes
26
+ */
27
+ export { ArrayElement, Arrayable, DoubleLinker, DoublyLinkedList, Linker, LinkedList, TreeLinker, LinkedTreeList, Queueable, Queue, TaskQueue, ScopedCollection, Stackable, Stack, TaskStack, recipes, services };
28
+ export type { IsArrayable, forEachCallback } from './recipes/IsArrayable';
29
+ export type { IsDoubleLinker } from './recipes/IsDoubleLinker';
30
+ export type { IsElement } from './recipes/IsElement';
31
+ export type { IsLinker } from './recipes/IsLinker';
32
+ export type { IsTree } from './recipes/IsTree';
33
+ export type { IsTreeNode } from './recipes/IsTreeNode';
34
+ export type { IsQueue } from './recipes/IsQueue';
35
+ export type { IsScopedCollection } from './recipes/IsScopedCollection';
36
+ export type { IsStack } from './recipes/IsStack';
37
+ export type { IsRunnable, completeResponse } from './recipes/Runnable';
38
+ /**
39
+ * All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
40
+ * set of classes as the named exports).
41
+ */
42
+ declare const collectYourStuff: {
43
+ ArrayElement: typeof ArrayElement;
44
+ Arrayable: typeof Arrayable;
45
+ DoubleLinker: typeof DoubleLinker;
46
+ DoublyLinkedList: typeof DoublyLinkedList;
47
+ Linker: typeof Linker;
48
+ LinkedList: typeof LinkedList;
49
+ TreeLinker: typeof TreeLinker;
50
+ LinkedTreeList: typeof LinkedTreeList;
51
+ Queueable: typeof Queueable;
52
+ Queue: typeof Queue;
53
+ TaskQueue: typeof TaskQueue;
54
+ ScopedCollection: typeof ScopedCollection;
55
+ Stackable: typeof Stackable;
56
+ Stack: typeof Stack;
57
+ TaskStack: typeof TaskStack;
58
+ recipes: {
59
+ ArrayIterator: typeof import("./recipes/ArrayIterator").ArrayIterator;
60
+ Runnable: typeof import("./recipes/Runnable").Runnable;
61
+ };
62
+ services: {
63
+ parseTree: (tree: import("./main").IsTree, callback: import("./main").forEachCallback) => import("./main").IsTree;
64
+ parseTreeNext: (treeNode: import("./main").IsTreeNode, boundaryParent?: import("./main").IsTreeNode | null) => import("./main").IsTreeNode | null;
65
+ };
66
+ };
67
+ export default collectYourStuff;
package/dist/main.js CHANGED
@@ -57,6 +57,12 @@ Object.defineProperty(exports, 'Queueable', {
57
57
  return _Queueable.Queueable
58
58
  }
59
59
  })
60
+ Object.defineProperty(exports, 'ScopedCollection', {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _ScopedCollection.ScopedCollection
64
+ }
65
+ })
60
66
  Object.defineProperty(exports, 'Stack', {
61
67
  enumerable: true,
62
68
  get: function () {
@@ -111,6 +117,7 @@ var _LinkedTreeList = require('./collections/linked-tree-list/LinkedTreeList')
111
117
  var _Queueable = require('./collections/queue/Queueable')
112
118
  var _Queue = require('./collections/queue/Queue')
113
119
  var _TaskQueue = require('./collections/queue/TaskQueue')
120
+ var _ScopedCollection = require('./collections/scoped-collection/ScopedCollection')
114
121
  var _Stackable = require('./collections/stack/Stackable')
115
122
  var _Stack = require('./collections/stack/Stack')
116
123
  var _TaskStack = require('./collections/stack/TaskStack')
@@ -118,10 +125,6 @@ var _recipes = require('./recipes/recipes')
118
125
  var _services = require('./services/services')
119
126
  /**
120
127
  * All of the collections available.
121
- * @file
122
- * @author Joshua Heagle <joshuaheagle@gmail.com>
123
- * @version 1.0.0
124
- * @module collect-your-stuff
125
128
  */
126
129
 
127
130
  /**
@@ -149,6 +152,7 @@ const collectYourStuff = {
149
152
  Queueable: _Queueable.Queueable,
150
153
  Queue: _Queue.Queue,
151
154
  TaskQueue: _TaskQueue.TaskQueue,
155
+ ScopedCollection: _ScopedCollection.ScopedCollection,
152
156
  Stackable: _Stackable.Stackable,
153
157
  Stack: _Stack.Stack,
154
158
  TaskStack: _TaskStack.TaskStack,
package/dist/main.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ArrayElement",{enumerable:!0,get:function(){return _ArrayElement.ArrayElement}}),Object.defineProperty(exports,"Arrayable",{enumerable:!0,get:function(){return _Arrayable.Arrayable}}),Object.defineProperty(exports,"DoubleLinker",{enumerable:!0,get:function(){return _DoubleLinker.DoubleLinker}}),Object.defineProperty(exports,"DoublyLinkedList",{enumerable:!0,get:function(){return _DoublyLinkedList.DoublyLinkedList}}),Object.defineProperty(exports,"LinkedList",{enumerable:!0,get:function(){return _LinkedList.LinkedList}}),Object.defineProperty(exports,"LinkedTreeList",{enumerable:!0,get:function(){return _LinkedTreeList.LinkedTreeList}}),Object.defineProperty(exports,"Linker",{enumerable:!0,get:function(){return _Linker.Linker}}),Object.defineProperty(exports,"Queue",{enumerable:!0,get:function(){return _Queue.Queue}}),Object.defineProperty(exports,"Queueable",{enumerable:!0,get:function(){return _Queueable.Queueable}}),Object.defineProperty(exports,"Stack",{enumerable:!0,get:function(){return _Stack.Stack}}),Object.defineProperty(exports,"Stackable",{enumerable:!0,get:function(){return _Stackable.Stackable}}),Object.defineProperty(exports,"TaskQueue",{enumerable:!0,get:function(){return _TaskQueue.TaskQueue}}),Object.defineProperty(exports,"TaskStack",{enumerable:!0,get:function(){return _TaskStack.TaskStack}}),Object.defineProperty(exports,"TreeLinker",{enumerable:!0,get:function(){return _TreeLinker.TreeLinker}}),exports.default=void 0,Object.defineProperty(exports,"recipes",{enumerable:!0,get:function(){return _recipes.recipes}}),Object.defineProperty(exports,"services",{enumerable:!0,get:function(){return _services.services}});var _ArrayElement=require("./collections/arrayable/ArrayElement"),_Arrayable=require("./collections/arrayable/Arrayable"),_DoubleLinker=require("./collections/doubly-linked-list/DoubleLinker"),_DoublyLinkedList=require("./collections/doubly-linked-list/DoublyLinkedList"),_Linker=require("./collections/linked-list/Linker"),_LinkedList=require("./collections/linked-list/LinkedList"),_TreeLinker=require("./collections/linked-tree-list/TreeLinker"),_LinkedTreeList=require("./collections/linked-tree-list/LinkedTreeList"),_Queueable=require("./collections/queue/Queueable"),_Queue=require("./collections/queue/Queue"),_TaskQueue=require("./collections/queue/TaskQueue"),_Stackable=require("./collections/stack/Stackable"),_Stack=require("./collections/stack/Stack"),_TaskStack=require("./collections/stack/TaskStack"),_recipes=require("./recipes/recipes"),_services=require("./services/services");const collectYourStuff={ArrayElement:_ArrayElement.ArrayElement,Arrayable:_Arrayable.Arrayable,DoubleLinker:_DoubleLinker.DoubleLinker,DoublyLinkedList:_DoublyLinkedList.DoublyLinkedList,Linker:_Linker.Linker,LinkedList:_LinkedList.LinkedList,TreeLinker:_TreeLinker.TreeLinker,LinkedTreeList:_LinkedTreeList.LinkedTreeList,Queueable:_Queueable.Queueable,Queue:_Queue.Queue,TaskQueue:_TaskQueue.TaskQueue,Stackable:_Stackable.Stackable,Stack:_Stack.Stack,TaskStack:_TaskStack.TaskStack,recipes:_recipes.recipes,services:_services.services};var _default=exports.default=collectYourStuff;"undefined"!=typeof window&&(window.collectYourStuff=collectYourStuff);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ArrayElement",{enumerable:!0,get:function(){return _ArrayElement.ArrayElement}}),Object.defineProperty(exports,"Arrayable",{enumerable:!0,get:function(){return _Arrayable.Arrayable}}),Object.defineProperty(exports,"DoubleLinker",{enumerable:!0,get:function(){return _DoubleLinker.DoubleLinker}}),Object.defineProperty(exports,"DoublyLinkedList",{enumerable:!0,get:function(){return _DoublyLinkedList.DoublyLinkedList}}),Object.defineProperty(exports,"LinkedList",{enumerable:!0,get:function(){return _LinkedList.LinkedList}}),Object.defineProperty(exports,"LinkedTreeList",{enumerable:!0,get:function(){return _LinkedTreeList.LinkedTreeList}}),Object.defineProperty(exports,"Linker",{enumerable:!0,get:function(){return _Linker.Linker}}),Object.defineProperty(exports,"Queue",{enumerable:!0,get:function(){return _Queue.Queue}}),Object.defineProperty(exports,"Queueable",{enumerable:!0,get:function(){return _Queueable.Queueable}}),Object.defineProperty(exports,"ScopedCollection",{enumerable:!0,get:function(){return _ScopedCollection.ScopedCollection}}),Object.defineProperty(exports,"Stack",{enumerable:!0,get:function(){return _Stack.Stack}}),Object.defineProperty(exports,"Stackable",{enumerable:!0,get:function(){return _Stackable.Stackable}}),Object.defineProperty(exports,"TaskQueue",{enumerable:!0,get:function(){return _TaskQueue.TaskQueue}}),Object.defineProperty(exports,"TaskStack",{enumerable:!0,get:function(){return _TaskStack.TaskStack}}),Object.defineProperty(exports,"TreeLinker",{enumerable:!0,get:function(){return _TreeLinker.TreeLinker}}),exports.default=void 0,Object.defineProperty(exports,"recipes",{enumerable:!0,get:function(){return _recipes.recipes}}),Object.defineProperty(exports,"services",{enumerable:!0,get:function(){return _services.services}});var _ArrayElement=require("./collections/arrayable/ArrayElement"),_Arrayable=require("./collections/arrayable/Arrayable"),_DoubleLinker=require("./collections/doubly-linked-list/DoubleLinker"),_DoublyLinkedList=require("./collections/doubly-linked-list/DoublyLinkedList"),_Linker=require("./collections/linked-list/Linker"),_LinkedList=require("./collections/linked-list/LinkedList"),_TreeLinker=require("./collections/linked-tree-list/TreeLinker"),_LinkedTreeList=require("./collections/linked-tree-list/LinkedTreeList"),_Queueable=require("./collections/queue/Queueable"),_Queue=require("./collections/queue/Queue"),_TaskQueue=require("./collections/queue/TaskQueue"),_ScopedCollection=require("./collections/scoped-collection/ScopedCollection"),_Stackable=require("./collections/stack/Stackable"),_Stack=require("./collections/stack/Stack"),_TaskStack=require("./collections/stack/TaskStack"),_recipes=require("./recipes/recipes"),_services=require("./services/services");const collectYourStuff={ArrayElement:_ArrayElement.ArrayElement,Arrayable:_Arrayable.Arrayable,DoubleLinker:_DoubleLinker.DoubleLinker,DoublyLinkedList:_DoublyLinkedList.DoublyLinkedList,Linker:_Linker.Linker,LinkedList:_LinkedList.LinkedList,TreeLinker:_TreeLinker.TreeLinker,LinkedTreeList:_LinkedTreeList.LinkedTreeList,Queueable:_Queueable.Queueable,Queue:_Queue.Queue,TaskQueue:_TaskQueue.TaskQueue,ScopedCollection:_ScopedCollection.ScopedCollection,Stackable:_Stackable.Stackable,Stack:_Stack.Stack,TaskStack:_TaskStack.TaskStack,recipes:_recipes.recipes,services:_services.services};var _default=exports.default=collectYourStuff;"undefined"!=typeof window&&(window.collectYourStuff=collectYourStuff);