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
@@ -7,14 +7,14 @@ export declare class ArrayIterator implements Iterator<IsElement> {
7
7
  private index;
8
8
  /**
9
9
  * Create an iterator over the given array.
10
- * @param {Array<IsElement>} innerList The elements to iterate over.
11
- * @param {number} [index=0] The position to start from.
10
+ * @param innerList The elements to iterate over.
11
+ * @param index The position to start from.
12
12
  */
13
13
  constructor(innerList: Array<IsElement>, index?: number);
14
14
  /**
15
15
  * Get the next element, moving the iterator forward.
16
- * @param {*} [value] Not used, present to match the Iterator interface.
17
- * @return {IteratorResult<IsElement>} The next element, or done when there are no more.
16
+ * @param value Not used, present to match the Iterator interface.
17
+ * @returns The next element, or done when there are no more.
18
18
  */
19
19
  next(value?: any): IteratorResult<IsElement>;
20
20
  }
@@ -10,8 +10,8 @@ exports.ArrayIterator = void 0
10
10
  class ArrayIterator {
11
11
  /**
12
12
  * Create an iterator over the given array.
13
- * @param {Array<IsElement>} innerList The elements to iterate over.
14
- * @param {number} [index=0] The position to start from.
13
+ * @param innerList The elements to iterate over.
14
+ * @param index The position to start from.
15
15
  */
16
16
  constructor (innerList, index = 0) {
17
17
  this.innerList = innerList
@@ -20,8 +20,8 @@ class ArrayIterator {
20
20
 
21
21
  /**
22
22
  * Get the next element, moving the iterator forward.
23
- * @param {*} [value] Not used, present to match the Iterator interface.
24
- * @return {IteratorResult<IsElement>} The next element, or done when there are no more.
23
+ * @param value Not used, present to match the Iterator interface.
24
+ * @returns The next element, or done when there are no more.
25
25
  */
26
26
  next (value) {
27
27
  if (this.index < this.innerList.length) {
@@ -6,13 +6,13 @@ export declare class DoubleLinkerIterator implements Iterator<IsDoubleLinker> {
6
6
  private current;
7
7
  /**
8
8
  * Create an iterator starting at the given item.
9
- * @param {IsDoubleLinker} current The item to start from.
9
+ * @param current The item to start from.
10
10
  */
11
11
  constructor(current: IsDoubleLinker);
12
12
  /**
13
13
  * Get the current item and move on to the following one.
14
- * @param {*} [value] Not used, present to match the Iterator interface.
15
- * @return {IteratorResult<IsDoubleLinker>} The current item, or done when there are no more.
14
+ * @param value Not used, present to match the Iterator interface.
15
+ * @returns The current item, or done when there are no more.
16
16
  */
17
17
  next(value?: any): IteratorResult<IsDoubleLinker>;
18
18
  }
@@ -10,7 +10,7 @@ exports.DoubleLinkerIterator = void 0
10
10
  class DoubleLinkerIterator {
11
11
  /**
12
12
  * Create an iterator starting at the given item.
13
- * @param {IsDoubleLinker} current The item to start from.
13
+ * @param current The item to start from.
14
14
  */
15
15
  constructor (current) {
16
16
  this.current = current
@@ -18,8 +18,8 @@ class DoubleLinkerIterator {
18
18
 
19
19
  /**
20
20
  * Get the current item and move on to the following one.
21
- * @param {*} [value] Not used, present to match the Iterator interface.
22
- * @return {IteratorResult<IsDoubleLinker>} The current item, or done when there are no more.
21
+ * @param value Not used, present to match the Iterator interface.
22
+ * @returns The current item, or done when there are no more.
23
23
  */
24
24
  next (value) {
25
25
  const result = {
@@ -1,11 +1,4 @@
1
1
  import { IsElement } from './IsElement';
2
- /**
3
- * Run this function for each element in this arrayable.
4
- * @callback forEachCallback
5
- * @param {number} index
6
- * @param {IsArrayable} thisArg
7
- * @returns void
8
- */
9
2
  export type forEachCallback = (element: IsElement, index?: number, thisArg?: IsArrayable<any>) => void;
10
3
  /**
11
4
  * Arrayable represents a collection stored as Elements.
@@ -26,80 +19,67 @@ export interface IsArrayable<T extends IsElement> {
26
19
  initialized: boolean;
27
20
  /**
28
21
  * Initialize the inner list, should only run once.
29
- * @param {IsArrayable|Array} initialList
30
- * @return {IsArrayable}
22
+ * @param initialList
31
23
  */
32
24
  initialize(initialList: Array<T> | T): IsArrayable<any>;
33
25
  /**
34
26
  * Retrieve a copy of the innerList used.
35
- * @returns {Array}
36
27
  */
37
28
  get list(): Array<IsElement> | IsElement;
38
29
  /**
39
30
  * Retrieve the first Element from the Arrayable
40
- * @returns {IsElement}
41
31
  */
42
32
  get first(): T;
43
33
  /**
44
34
  * Retrieve the last Element from the Arrayable
45
- * @returns {IsElement}
46
35
  */
47
36
  get last(): T;
48
37
  /**
49
38
  * Return the length of the list.
50
- * @returns {number}
51
39
  */
52
40
  get length(): number;
53
41
  /**
54
42
  * Insert a new node (or data) after a node.
55
- * @param {IsElement} node
56
- * @param {IsElement|*} newNode
57
- * @returns {IsArrayable}
43
+ * @param node
44
+ * @param newNode
58
45
  */
59
46
  insertAfter(node: T, newNode: T | any): IsArrayable<any>;
60
47
  /**
61
48
  * Insert a new node (or data) before a node.
62
- * @param {IsElement} node
63
- * @param {IsElement|*} newNode
64
- * @returns {IsArrayable}
49
+ * @param node
50
+ * @param newNode
65
51
  */
66
52
  insertBefore(node: T, newNode: T | any): IsArrayable<any>;
67
53
  /**
68
54
  * Add a node (or data) after the given (or last) node in the list.
69
- * @param {IsElement|*} node
70
- * @param {IsElement} after
71
- * @returns {IsArrayable}
55
+ * @param node
56
+ * @param after
72
57
  */
73
58
  append(node: T | any, after?: T): IsArrayable<any>;
74
59
  /**
75
60
  * Add a node (or data) before the given (or first) node in the list.
76
- * @param {IsElement|*} node
77
- * @param {IsElement} before
78
- * @returns {IsArrayable}
61
+ * @param node
62
+ * @param before
79
63
  */
80
64
  prepend(node: T | any, before?: T): IsArrayable<any>;
81
65
  /**
82
66
  * Remove an element from this arrayable.
83
- * @param {IsElement} node
84
- * @return {IsElement}
67
+ * @param node
85
68
  */
86
69
  remove(node: T): T;
87
70
  /**
88
71
  * Retrieve an element item from this list by numeric index, otherwise return null.
89
- * @param {number} index
90
- * @return {IsElement|null}
72
+ * @param index
91
73
  */
92
74
  item(index: number): T | null;
93
75
  /**
94
76
  * Be able to run forEach on this Arrayable to iterate over the elements.
95
- * @param {forEachCallback} callback
96
- * @param {IsArrayable} thisArg
97
- * @returns {IsArrayable}
77
+ * @param callback
78
+ * @param thisArg
98
79
  */
99
80
  forEach(callback: forEachCallback, thisArg?: IsArrayable<any>): IsArrayable<any>;
100
81
  /**
101
82
  * Be able to iterate over this class.
102
- * @returns {Iterator}
103
83
  */
104
84
  [Symbol.iterator](): Iterator<T>;
105
85
  }
@@ -1,8 +1,5 @@
1
1
  /**
2
- * @file Queue recipe.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- * @memberOf module:collect-your-stuff
2
+ * Queue recipe.
6
3
  */
7
4
  /**
8
5
  * Define a first-in-first-out queue: items are added to the back (enqueue) and taken from the front (dequeue).
@@ -11,27 +8,25 @@
11
8
  export interface IsQueue<T = any> {
12
9
  /**
13
10
  * Take the item from the front of the queue.
14
- * @return {T|null} The item, or null when the queue is empty
11
+ * @returns The item, or null when the queue is empty
15
12
  */
16
13
  dequeue: () => T | null;
17
14
  /**
18
15
  * Check whether the queue has no items.
19
- * @return {boolean}
20
16
  */
21
17
  empty: () => boolean;
22
18
  /**
23
19
  * Add an item to the back of the queue.
24
- * @param {T} data The item to add
20
+ * @param data The item to add
25
21
  */
26
22
  enqueue: (data: T) => void;
27
23
  /**
28
24
  * Look at the item at the front of the queue, without removing it.
29
- * @return {T|null} The item, or null when the queue is empty
25
+ * @returns The item, or null when the queue is empty
30
26
  */
31
27
  peek: () => T | null;
32
28
  /**
33
29
  * Count the items in the queue.
34
- * @return {number}
35
30
  */
36
31
  size: () => number;
37
32
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * ScopedCollection recipe.
3
+ */
4
+ /**
5
+ * Define a keyed collection partitioned by scope: every scope has its own independent key space, and a scope
6
+ * that is no longer referenced anywhere else takes its whole key space with it.
7
+ */
8
+ export interface IsScopedCollection<Scope extends object = object, Key = any, Value = any> {
9
+ /**
10
+ * Remove a key from a scope's key space.
11
+ * @returns Whether a value was actually removed
12
+ */
13
+ delete: (scope: Scope, key: Key) => boolean;
14
+ /**
15
+ * Look up a value by key within a scope.
16
+ * @returns The value, or undefined when the scope or key is not present
17
+ */
18
+ get: (scope: Scope, key: Key) => Value | undefined;
19
+ /**
20
+ * Check whether a key exists within a scope.
21
+ */
22
+ has: (scope: Scope, key: Key) => boolean;
23
+ /**
24
+ * Store a value under a key within a scope.
25
+ */
26
+ set: (scope: Scope, key: Key, value: Value) => void;
27
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,8 +1,5 @@
1
1
  /**
2
- * @file Stack recipe.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- * @memberOf module:collect-your-stuff
2
+ * Stack recipe.
6
3
  */
7
4
  /**
8
5
  * Define a last-in-first-out stack: items are added to the top (push) and taken from the top (pop).
@@ -10,27 +7,25 @@
10
7
  export interface IsStack<T = any> {
11
8
  /**
12
9
  * Check whether the stack has no items.
13
- * @return {boolean}
14
10
  */
15
11
  empty: () => boolean;
16
12
  /**
17
13
  * Look at the item on the top of the stack, without removing it.
18
- * @return {T|null} The item, or null when the stack is empty
14
+ * @returns The item, or null when the stack is empty
19
15
  */
20
16
  peek: () => T | null;
21
17
  /**
22
18
  * Take the item from the top of the stack.
23
- * @return {T|null} The item, or null when the stack is empty
19
+ * @returns The item, or null when the stack is empty
24
20
  */
25
21
  pop: () => T | null;
26
22
  /**
27
23
  * Add an item to the top of the stack.
28
- * @param {T} data The item to add
24
+ * @param data The item to add
29
25
  */
30
26
  push: (data: T) => void;
31
27
  /**
32
28
  * Count the items in the stack.
33
- * @return {number}
34
29
  */
35
30
  size: () => number;
36
31
  }
@@ -23,7 +23,7 @@ export interface IsTreeNode extends IsDoubleLinker {
23
23
  children: IsArrayable<IsTreeNode> | null;
24
24
  /**
25
25
  * Create the children for this tree from an array.
26
- * @param {Array} children
26
+ * @param children
27
27
  */
28
28
  childrenFromArray(children: Array<any> | null): LinkedTreeList;
29
29
  }
@@ -6,13 +6,13 @@ export declare class LinkerIterator implements Iterator<IsLinker> {
6
6
  private current;
7
7
  /**
8
8
  * Create an iterator starting at the given item.
9
- * @param {IsLinker} current The item to start from.
9
+ * @param current The item to start from.
10
10
  */
11
11
  constructor(current: IsLinker);
12
12
  /**
13
13
  * Get the current item and move on to the following one.
14
- * @param {*} [value] Not used, present to match the Iterator interface.
15
- * @return {IteratorResult<IsLinker>} The current item, or done when there are no more.
14
+ * @param value Not used, present to match the Iterator interface.
15
+ * @returns The current item, or done when there are no more.
16
16
  */
17
17
  next(value?: any): IteratorResult<IsLinker>;
18
18
  }
@@ -10,7 +10,7 @@ exports.LinkerIterator = void 0
10
10
  class LinkerIterator {
11
11
  /**
12
12
  * Create an iterator starting at the given item.
13
- * @param {IsLinker} current The item to start from.
13
+ * @param current The item to start from.
14
14
  */
15
15
  constructor (current) {
16
16
  this.current = current
@@ -18,8 +18,8 @@ class LinkerIterator {
18
18
 
19
19
  /**
20
20
  * Get the current item and move on to the following one.
21
- * @param {*} [value] Not used, present to match the Iterator interface.
22
- * @return {IteratorResult<IsLinker>} The current item, or done when there are no more.
21
+ * @param value Not used, present to match the Iterator interface.
22
+ * @returns The current item, or done when there are no more.
23
23
  */
24
24
  next (value) {
25
25
  const result = {
@@ -1,15 +1,5 @@
1
1
  /**
2
- * @file Runnable class recipe.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- * @memberOf module:collect-your-stuff
6
- */
7
- /**
8
- * Return results of the task.
9
- * @typedef {Object} completeResponse
10
- * @property {*} success
11
- * @property {*} error
12
- * @property {*} context
2
+ * Runnable class recipe.
13
3
  */
14
4
  export type completeResponse = {
15
5
  success: boolean | any;
@@ -32,24 +22,21 @@ export declare class Runnable implements IsRunnable {
32
22
  data: any;
33
23
  /**
34
24
  * Instantiate a Runnable class.
35
- * @param {*} [data=null] The task (a function) or the data which the task returns.
25
+ * @param data The task (a function) or the data which the task returns.
36
26
  */
37
27
  constructor(data?: any);
38
28
  /**
39
29
  * Retrieve the data which should be formed as a task.
40
- * @return {Function}
41
30
  */
42
31
  get task(): Function;
43
32
  /**
44
33
  * Run the runnable task.
45
- * @return {*}
46
34
  */
47
35
  run(): completeResponse | any;
48
36
  /**
49
37
  * Check if a given thing is Runnable
50
38
  * @memberof Runnable
51
- * @param {*} thing The value to check, or nothing to check whether this class is Runnable.
52
- * @return {boolean}
39
+ * @param thing The value to check, or nothing to check whether this class is Runnable.
53
40
  */
54
41
  static isRunnable(thing: any): boolean;
55
42
  }
@@ -5,10 +5,7 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.Runnable = void 0
7
7
  /**
8
- * @file Runnable class recipe.
9
- * @author Joshua Heagle <joshuaheagle@gmail.com>
10
- * @version 1.0.0
11
- * @memberOf module:collect-your-stuff
8
+ * Runnable class recipe.
12
9
  */
13
10
  /**
14
11
  * Identify a class that can be run.
@@ -16,7 +13,7 @@ exports.Runnable = void 0
16
13
  class Runnable {
17
14
  /**
18
15
  * Instantiate a Runnable class.
19
- * @param {*} [data=null] The task (a function) or the data which the task returns.
16
+ * @param data The task (a function) or the data which the task returns.
20
17
  */
21
18
  constructor (data = null) {
22
19
  /** The task (or data) this runnable holds. */
@@ -26,7 +23,6 @@ class Runnable {
26
23
 
27
24
  /**
28
25
  * Retrieve the data which should be formed as a task.
29
- * @return {Function}
30
26
  */
31
27
  get task () {
32
28
  if (typeof this.data === 'function') {
@@ -37,7 +33,6 @@ class Runnable {
37
33
 
38
34
  /**
39
35
  * Run the runnable task.
40
- * @return {*}
41
36
  */
42
37
  run () {
43
38
  return this.task()
@@ -46,8 +41,7 @@ class Runnable {
46
41
  /**
47
42
  * Check if a given thing is Runnable
48
43
  * @memberof Runnable
49
- * @param {*} thing The value to check, or nothing to check whether this class is Runnable.
50
- * @return {boolean}
44
+ * @param thing The value to check, or nothing to check whether this class is Runnable.
51
45
  */
52
46
  static isRunnable (thing) {
53
47
  if (typeof thing === 'undefined') {
@@ -7,14 +7,14 @@ export declare class TreeLinkerIterator implements Iterator<IsTreeNode> {
7
7
  private readonly boundaryParent;
8
8
  /**
9
9
  * Create an iterator starting at the given item.
10
- * @param {IsTreeNode} current The item to start from.
11
- * @param {IsTreeNode|null} [boundaryParent] The parent of the nodes to stay within (null for the top of a tree), the whole tree when not given.
10
+ * @param current The item to start from.
11
+ * @param boundaryParent The parent of the nodes to stay within (null for the top of a tree), the whole tree when not given.
12
12
  */
13
13
  constructor(current: IsTreeNode, boundaryParent?: IsTreeNode | null);
14
14
  /**
15
15
  * Get the current item and move on to the following one (left-first, down each branch).
16
- * @param {*} [value] Not used, present to match the Iterator interface.
17
- * @return {IteratorResult<IsTreeNode>} The current item, or done when there are no more.
16
+ * @param value Not used, present to match the Iterator interface.
17
+ * @returns The current item, or done when there are no more.
18
18
  */
19
19
  next(value?: any): IteratorResult<IsTreeNode>;
20
20
  }
@@ -1,36 +1,36 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.TreeLinkerIterator = void 0
7
- const _parseTreeNext = require('../services/parseTreeNext')
8
- /**
9
- * Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
10
- */
11
- class TreeLinkerIterator {
12
- /**
13
- * Create an iterator starting at the given item.
14
- * @param {IsTreeNode} current The item to start from.
15
- * @param {IsTreeNode|null} [boundaryParent] The parent of the nodes to stay within (null for the top of a tree), the whole tree when not given.
16
- */
17
- constructor (current, boundaryParent) {
18
- this.current = current
19
- this.boundaryParent = boundaryParent
20
- }
21
-
22
- /**
23
- * Get the current item and move on to the following one (left-first, down each branch).
24
- * @param {*} [value] Not used, present to match the Iterator interface.
25
- * @return {IteratorResult<IsTreeNode>} The current item, or done when there are no more.
26
- */
27
- next (value) {
28
- const result = {
29
- value: this.current,
30
- done: !this.current
31
- }
32
- this.current = (0, _parseTreeNext.parseTreeNext)(this.current, this.boundaryParent)
33
- return result
34
- }
35
- }
36
- exports.TreeLinkerIterator = TreeLinkerIterator
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.TreeLinkerIterator = void 0
7
+ const _parseTreeNext = require('../services/parseTreeNext')
8
+ /**
9
+ * Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
10
+ */
11
+ class TreeLinkerIterator {
12
+ /**
13
+ * Create an iterator starting at the given item.
14
+ * @param current The item to start from.
15
+ * @param boundaryParent The parent of the nodes to stay within (null for the top of a tree), the whole tree when not given.
16
+ */
17
+ constructor (current, boundaryParent) {
18
+ this.current = current
19
+ this.boundaryParent = boundaryParent
20
+ }
21
+
22
+ /**
23
+ * Get the current item and move on to the following one (left-first, down each branch).
24
+ * @param value Not used, present to match the Iterator interface.
25
+ * @returns The current item, or done when there are no more.
26
+ */
27
+ next (value) {
28
+ const result = {
29
+ value: this.current,
30
+ done: !this.current
31
+ }
32
+ this.current = (0, _parseTreeNext.parseTreeNext)(this.current, this.boundaryParent)
33
+ return result
34
+ }
35
+ }
36
+ exports.TreeLinkerIterator = TreeLinkerIterator
@@ -1,8 +1,5 @@
1
1
  /**
2
- * @file sample classes which follow a pattern (have certain members or methods).
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- * @memberOf module:collect-your-stuff
2
+ * sample classes which follow a pattern (have certain members or methods).
6
3
  */
7
4
  import { ArrayIterator } from './ArrayIterator';
8
5
  import { Runnable } from './Runnable';
@@ -1,22 +1,19 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.recipes = void 0
7
- const _ArrayIterator = require('./ArrayIterator')
8
- const _Runnable = require('./Runnable')
9
- /**
10
- * @file sample classes which follow a pattern (have certain members or methods).
11
- * @author Joshua Heagle <joshuaheagle@gmail.com>
12
- * @version 1.0.0
13
- * @memberOf module:collect-your-stuff
14
- */
15
-
16
- /**
17
- * List of class declarations that can be used to specify attributes for a style of object / class.
18
- */
19
- const recipes = exports.recipes = {
20
- ArrayIterator: _ArrayIterator.ArrayIterator,
21
- Runnable: _Runnable.Runnable
22
- }
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.recipes = void 0
7
+ const _ArrayIterator = require('./ArrayIterator')
8
+ const _Runnable = require('./Runnable')
9
+ /**
10
+ * sample classes which follow a pattern (have certain members or methods).
11
+ */
12
+
13
+ /**
14
+ * List of class declarations that can be used to specify attributes for a style of object / class.
15
+ */
16
+ const recipes = exports.recipes = {
17
+ ArrayIterator: _ArrayIterator.ArrayIterator,
18
+ Runnable: _Runnable.Runnable
19
+ }
@@ -2,8 +2,7 @@ import { forEachCallback } from '../recipes/IsArrayable';
2
2
  import { IsTree } from '../recipes/IsTree';
3
3
  /**
4
4
  * Loop over all the nodes in a tree starting from left and apply a callback for each
5
- * @param {IsArrayable<IsTreeNode>} tree
6
- * @param {forEachCallback} callback
7
- * @returns {IsArrayable<IsTreeNode>}
5
+ * @param tree
6
+ * @param callback
8
7
  */
9
8
  export declare const parseTree: (tree: IsTree, callback: forEachCallback) => IsTree;
@@ -1,24 +1,23 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.parseTree = void 0
7
- const _parseTreeNext = require('./parseTreeNext')
8
- /**
9
- * Loop over all the nodes in a tree starting from left and apply a callback for each
10
- * @param {IsArrayable<IsTreeNode>} tree
11
- * @param {forEachCallback} callback
12
- * @returns {IsArrayable<IsTreeNode>}
13
- */
14
- const parseTree = (tree, callback) => {
15
- let index = 0
16
- let current = tree.rootParent
17
- while (current !== null) {
18
- callback(current, index, tree)
19
- current = (0, _parseTreeNext.parseTreeNext)(current)
20
- ++index
21
- }
22
- return tree
23
- }
24
- exports.parseTree = parseTree
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.parseTree = void 0
7
+ const _parseTreeNext = require('./parseTreeNext')
8
+ /**
9
+ * Loop over all the nodes in a tree starting from left and apply a callback for each
10
+ * @param tree
11
+ * @param callback
12
+ */
13
+ const parseTree = (tree, callback) => {
14
+ let index = 0
15
+ let current = tree.rootParent
16
+ while (current !== null) {
17
+ callback(current, index, tree)
18
+ current = (0, _parseTreeNext.parseTreeNext)(current)
19
+ ++index
20
+ }
21
+ return tree
22
+ }
23
+ exports.parseTree = parseTree