collect-your-stuff 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -3241
- package/browser/collect-your-stuff.js +1585 -1193
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
- package/dist/collections/arrayable/ArrayElement.js +64 -66
- package/dist/collections/arrayable/Arrayable.d.ts +107 -122
- package/dist/collections/arrayable/Arrayable.js +208 -223
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
- package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
- package/dist/collections/linked-list/LinkedList.d.ts +110 -126
- package/dist/collections/linked-list/LinkedList.js +283 -296
- package/dist/collections/linked-list/Linker.d.ts +41 -46
- package/dist/collections/linked-list/Linker.js +82 -84
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
- package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
- package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
- package/dist/collections/queue/Queue.d.ts +55 -59
- package/dist/collections/queue/Queue.js +114 -119
- package/dist/collections/queue/Queueable.d.ts +74 -83
- package/dist/collections/queue/Queueable.js +142 -146
- package/dist/collections/queue/TaskQueue.d.ts +59 -68
- package/dist/collections/queue/TaskQueue.js +128 -137
- package/dist/collections/scoped-collection/ScopedCollection.d.ts +42 -0
- package/dist/collections/scoped-collection/ScopedCollection.js +81 -0
- package/dist/collections/scoped-collection/ScopedCollection.min.js +1 -0
- package/dist/collections/stack/Stack.d.ts +60 -64
- package/dist/collections/stack/Stack.js +122 -127
- package/dist/collections/stack/Stackable.d.ts +52 -59
- package/dist/collections/stack/Stackable.js +81 -85
- package/dist/collections/stack/TaskStack.d.ts +56 -65
- package/dist/collections/stack/TaskStack.js +98 -107
- package/dist/main.d.ts +4 -5
- package/dist/main.js +9 -5
- package/dist/main.min.js +1 -1
- package/dist/recipes/ArrayIterator.d.ts +20 -20
- package/dist/recipes/ArrayIterator.js +39 -39
- package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
- package/dist/recipes/DoubleLinkerIterator.js +33 -33
- package/dist/recipes/IsArrayable.d.ts +85 -105
- package/dist/recipes/IsArrayable.js +5 -5
- package/dist/recipes/IsDoubleLinker.d.ts +14 -14
- package/dist/recipes/IsDoubleLinker.js +5 -5
- package/dist/recipes/IsElement.d.ts +14 -14
- package/dist/recipes/IsElement.js +5 -5
- package/dist/recipes/IsLinker.d.ts +10 -10
- package/dist/recipes/IsLinker.js +5 -5
- package/dist/recipes/IsQueue.d.ts +32 -37
- package/dist/recipes/IsQueue.js +5 -5
- package/dist/recipes/IsScopedCollection.d.ts +27 -0
- package/dist/recipes/IsScopedCollection.js +5 -0
- package/dist/recipes/IsScopedCollection.min.js +1 -0
- package/dist/recipes/IsStack.d.ts +31 -36
- package/dist/recipes/IsStack.js +5 -5
- package/dist/recipes/IsTree.d.ts +11 -11
- package/dist/recipes/IsTree.js +5 -5
- package/dist/recipes/IsTreeNode.d.ts +29 -29
- package/dist/recipes/IsTreeNode.js +5 -5
- package/dist/recipes/LinkerIterator.d.ts +18 -18
- package/dist/recipes/LinkerIterator.js +33 -33
- package/dist/recipes/Runnable.d.ts +42 -55
- package/dist/recipes/Runnable.js +63 -69
- package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
- package/dist/recipes/TreeLinkerIterator.js +36 -36
- package/dist/recipes/recipes.d.ts +12 -15
- package/dist/recipes/recipes.js +19 -22
- package/dist/services/parseTree.d.ts +8 -9
- package/dist/services/parseTree.js +23 -24
- package/dist/services/parseTreeNext.d.ts +16 -17
- package/dist/services/parseTreeNext.js +41 -42
- package/dist/services/services.d.ts +10 -13
- package/dist/services/services.js +19 -22
- package/package.json +4 -4
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { IsArrayable } from './IsArrayable';
|
|
2
|
-
import { IsDoubleLinker } from './IsDoubleLinker';
|
|
3
|
-
import { LinkedTreeList } from '../collections/linked-tree-list/LinkedTreeList';
|
|
4
|
-
/**
|
|
5
|
-
* Define the common attributes of a Tree Node for a tree structure.
|
|
6
|
-
*/
|
|
7
|
-
export interface IsTreeNode extends IsDoubleLinker {
|
|
8
|
-
/**
|
|
9
|
-
* @property {IsTreeNode} [next=null]
|
|
10
|
-
*/
|
|
11
|
-
next: IsTreeNode;
|
|
12
|
-
/**
|
|
13
|
-
* @property {IsTreeNode} [prev=null]
|
|
14
|
-
*/
|
|
15
|
-
prev: IsTreeNode;
|
|
16
|
-
/**
|
|
17
|
-
* @property {IsTreeNode|null} [parent=null]
|
|
18
|
-
*/
|
|
19
|
-
parent: IsTreeNode | null;
|
|
20
|
-
/**
|
|
21
|
-
* @property {IsArrayable<IsTreeNode>|null} [children=null]
|
|
22
|
-
*/
|
|
23
|
-
children: IsArrayable<IsTreeNode> | null;
|
|
24
|
-
/**
|
|
25
|
-
* Create the children for this tree from an array.
|
|
26
|
-
* @param
|
|
27
|
-
*/
|
|
28
|
-
childrenFromArray(children: Array<any> | null): LinkedTreeList;
|
|
29
|
-
}
|
|
1
|
+
import { IsArrayable } from './IsArrayable';
|
|
2
|
+
import { IsDoubleLinker } from './IsDoubleLinker';
|
|
3
|
+
import { LinkedTreeList } from '../collections/linked-tree-list/LinkedTreeList';
|
|
4
|
+
/**
|
|
5
|
+
* Define the common attributes of a Tree Node for a tree structure.
|
|
6
|
+
*/
|
|
7
|
+
export interface IsTreeNode extends IsDoubleLinker {
|
|
8
|
+
/**
|
|
9
|
+
* @property {IsTreeNode} [next=null]
|
|
10
|
+
*/
|
|
11
|
+
next: IsTreeNode;
|
|
12
|
+
/**
|
|
13
|
+
* @property {IsTreeNode} [prev=null]
|
|
14
|
+
*/
|
|
15
|
+
prev: IsTreeNode;
|
|
16
|
+
/**
|
|
17
|
+
* @property {IsTreeNode|null} [parent=null]
|
|
18
|
+
*/
|
|
19
|
+
parent: IsTreeNode | null;
|
|
20
|
+
/**
|
|
21
|
+
* @property {IsArrayable<IsTreeNode>|null} [children=null]
|
|
22
|
+
*/
|
|
23
|
+
children: IsArrayable<IsTreeNode> | null;
|
|
24
|
+
/**
|
|
25
|
+
* Create the children for this tree from an array.
|
|
26
|
+
* @param children
|
|
27
|
+
*/
|
|
28
|
+
childrenFromArray(children: Array<any> | null): LinkedTreeList;
|
|
29
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { IsLinker } from './IsLinker';
|
|
2
|
-
/**
|
|
3
|
-
* Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
4
|
-
*/
|
|
5
|
-
export declare class LinkerIterator implements Iterator<IsLinker> {
|
|
6
|
-
private current;
|
|
7
|
-
/**
|
|
8
|
-
* Create an iterator starting at the given item.
|
|
9
|
-
* @param
|
|
10
|
-
*/
|
|
11
|
-
constructor(current: IsLinker);
|
|
12
|
-
/**
|
|
13
|
-
* Get the current item and move on to the following one.
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
16
|
-
*/
|
|
17
|
-
next(value?: any): IteratorResult<IsLinker>;
|
|
18
|
-
}
|
|
1
|
+
import { IsLinker } from './IsLinker';
|
|
2
|
+
/**
|
|
3
|
+
* Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LinkerIterator implements Iterator<IsLinker> {
|
|
6
|
+
private current;
|
|
7
|
+
/**
|
|
8
|
+
* Create an iterator starting at the given item.
|
|
9
|
+
* @param current The item to start from.
|
|
10
|
+
*/
|
|
11
|
+
constructor(current: IsLinker);
|
|
12
|
+
/**
|
|
13
|
+
* Get the current item and move on to the following one.
|
|
14
|
+
* @param value Not used, present to match the Iterator interface.
|
|
15
|
+
* @returns The current item, or done when there are no more.
|
|
16
|
+
*/
|
|
17
|
+
next(value?: any): IteratorResult<IsLinker>;
|
|
18
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.LinkerIterator = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
|
-
*/
|
|
10
|
-
class LinkerIterator {
|
|
11
|
-
/**
|
|
12
|
-
* Create an iterator starting at the given item.
|
|
13
|
-
* @param
|
|
14
|
-
*/
|
|
15
|
-
constructor (current) {
|
|
16
|
-
this.current = current
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get the current item and move on to the following one.
|
|
21
|
-
* @param
|
|
22
|
-
* @
|
|
23
|
-
*/
|
|
24
|
-
next (value) {
|
|
25
|
-
const result = {
|
|
26
|
-
value: this.current,
|
|
27
|
-
done: !this.current
|
|
28
|
-
}
|
|
29
|
-
this.current = this.current ? this.current.next : null
|
|
30
|
-
return result
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.LinkerIterator = LinkerIterator
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.LinkerIterator = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
|
+
*/
|
|
10
|
+
class LinkerIterator {
|
|
11
|
+
/**
|
|
12
|
+
* Create an iterator starting at the given item.
|
|
13
|
+
* @param current The item to start from.
|
|
14
|
+
*/
|
|
15
|
+
constructor (current) {
|
|
16
|
+
this.current = current
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the current item and move on to the following one.
|
|
21
|
+
* @param value Not used, present to match the Iterator interface.
|
|
22
|
+
* @returns The current item, or done when there are no more.
|
|
23
|
+
*/
|
|
24
|
+
next (value) {
|
|
25
|
+
const result = {
|
|
26
|
+
value: this.current,
|
|
27
|
+
done: !this.current
|
|
28
|
+
}
|
|
29
|
+
this.current = this.current ? this.current.next : null
|
|
30
|
+
return result
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.LinkerIterator = LinkerIterator
|
|
@@ -1,55 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Run the runnable task.
|
|
45
|
-
* @return {*}
|
|
46
|
-
*/
|
|
47
|
-
run(): completeResponse | any;
|
|
48
|
-
/**
|
|
49
|
-
* Check if a given thing is Runnable
|
|
50
|
-
* @memberof Runnable
|
|
51
|
-
* @param {*} thing The value to check, or nothing to check whether this class is Runnable.
|
|
52
|
-
* @return {boolean}
|
|
53
|
-
*/
|
|
54
|
-
static isRunnable(thing: any): boolean;
|
|
55
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Runnable class recipe.
|
|
3
|
+
*/
|
|
4
|
+
export type completeResponse = {
|
|
5
|
+
success: boolean | any;
|
|
6
|
+
error: boolean | any;
|
|
7
|
+
context: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Specify a type of class that is Runnable.
|
|
11
|
+
*/
|
|
12
|
+
export interface IsRunnable {
|
|
13
|
+
data: any;
|
|
14
|
+
get task(): Function;
|
|
15
|
+
run(): completeResponse | any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Identify a class that can be run.
|
|
19
|
+
*/
|
|
20
|
+
export declare class Runnable implements IsRunnable {
|
|
21
|
+
/** The task (or data) this runnable holds. */
|
|
22
|
+
data: any;
|
|
23
|
+
/**
|
|
24
|
+
* Instantiate a Runnable class.
|
|
25
|
+
* @param data The task (a function) or the data which the task returns.
|
|
26
|
+
*/
|
|
27
|
+
constructor(data?: any);
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve the data which should be formed as a task.
|
|
30
|
+
*/
|
|
31
|
+
get task(): Function;
|
|
32
|
+
/**
|
|
33
|
+
* Run the runnable task.
|
|
34
|
+
*/
|
|
35
|
+
run(): completeResponse | any;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a given thing is Runnable
|
|
38
|
+
* @memberof Runnable
|
|
39
|
+
* @param thing The value to check, or nothing to check whether this class is Runnable.
|
|
40
|
+
*/
|
|
41
|
+
static isRunnable(thing: any): boolean;
|
|
42
|
+
}
|
package/dist/recipes/Runnable.js
CHANGED
|
@@ -1,69 +1,63 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.Runnable = void 0
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
// Finally, it has a runnable 'run' method. This method should return the result of running the task.
|
|
66
|
-
return typeof thing.run === 'function'
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.Runnable = Runnable
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.Runnable = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Runnable class recipe.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Identify a class that can be run.
|
|
12
|
+
*/
|
|
13
|
+
class Runnable {
|
|
14
|
+
/**
|
|
15
|
+
* Instantiate a Runnable class.
|
|
16
|
+
* @param data The task (a function) or the data which the task returns.
|
|
17
|
+
*/
|
|
18
|
+
constructor (data = null) {
|
|
19
|
+
/** The task (or data) this runnable holds. */
|
|
20
|
+
this.data = null
|
|
21
|
+
this.data = data
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve the data which should be formed as a task.
|
|
26
|
+
*/
|
|
27
|
+
get task () {
|
|
28
|
+
if (typeof this.data === 'function') {
|
|
29
|
+
return this.data
|
|
30
|
+
}
|
|
31
|
+
return () => this.data
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Run the runnable task.
|
|
36
|
+
*/
|
|
37
|
+
run () {
|
|
38
|
+
return this.task()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Check if a given thing is Runnable
|
|
43
|
+
* @memberof Runnable
|
|
44
|
+
* @param thing The value to check, or nothing to check whether this class is Runnable.
|
|
45
|
+
*/
|
|
46
|
+
static isRunnable (thing) {
|
|
47
|
+
if (typeof thing === 'undefined') {
|
|
48
|
+
// No argument past, this class is runnable
|
|
49
|
+
return this instanceof Runnable
|
|
50
|
+
}
|
|
51
|
+
if (typeof thing !== 'object') {
|
|
52
|
+
// It is not even an object, so cannot be a class instance
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
if (typeof thing.task !== 'function') {
|
|
56
|
+
// It does not have a task getter that returns a function
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
// Finally, it has a runnable 'run' method. This method should return the result of running the task.
|
|
60
|
+
return typeof thing.run === 'function'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Runnable = Runnable
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { IsTreeNode } from './IsTreeNode';
|
|
2
|
-
/**
|
|
3
|
-
* Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
|
|
4
|
-
*/
|
|
5
|
-
export declare class TreeLinkerIterator implements Iterator<IsTreeNode> {
|
|
6
|
-
private current;
|
|
7
|
-
private readonly boundaryParent;
|
|
8
|
-
/**
|
|
9
|
-
* Create an iterator starting at the given item.
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
*/
|
|
13
|
-
constructor(current: IsTreeNode, boundaryParent?: IsTreeNode | null);
|
|
14
|
-
/**
|
|
15
|
-
* Get the current item and move on to the following one (left-first, down each branch).
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
18
|
-
*/
|
|
19
|
-
next(value?: any): IteratorResult<IsTreeNode>;
|
|
20
|
-
}
|
|
1
|
+
import { IsTreeNode } from './IsTreeNode';
|
|
2
|
+
/**
|
|
3
|
+
* Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
|
|
4
|
+
*/
|
|
5
|
+
export declare class TreeLinkerIterator implements Iterator<IsTreeNode> {
|
|
6
|
+
private current;
|
|
7
|
+
private readonly boundaryParent;
|
|
8
|
+
/**
|
|
9
|
+
* Create an iterator starting at the given item.
|
|
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
|
+
*/
|
|
13
|
+
constructor(current: IsTreeNode, boundaryParent?: IsTreeNode | null);
|
|
14
|
+
/**
|
|
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
|
+
* @returns The current item, or done when there are no more.
|
|
18
|
+
*/
|
|
19
|
+
next(value?: any): IteratorResult<IsTreeNode>;
|
|
20
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.TreeLinkerIterator = void 0
|
|
7
|
-
|
|
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
|
|
15
|
-
* @param
|
|
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
|
|
25
|
-
* @
|
|
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,15 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ArrayIterator: typeof ArrayIterator;
|
|
14
|
-
Runnable: typeof Runnable;
|
|
15
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* sample classes which follow a pattern (have certain members or methods).
|
|
3
|
+
*/
|
|
4
|
+
import { ArrayIterator } from './ArrayIterator';
|
|
5
|
+
import { Runnable } from './Runnable';
|
|
6
|
+
/**
|
|
7
|
+
* List of class declarations that can be used to specify attributes for a style of object / class.
|
|
8
|
+
*/
|
|
9
|
+
export declare const recipes: {
|
|
10
|
+
ArrayIterator: typeof ArrayIterator;
|
|
11
|
+
Runnable: typeof Runnable;
|
|
12
|
+
};
|
package/dist/recipes/recipes.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.recipes = void 0
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { forEachCallback } from '../recipes/IsArrayable';
|
|
2
|
-
import { IsTree } from '../recipes/IsTree';
|
|
3
|
-
/**
|
|
4
|
-
* Loop over all the nodes in a tree starting from left and apply a callback for each
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const parseTree: (tree: IsTree, callback: forEachCallback) => IsTree;
|
|
1
|
+
import { forEachCallback } from '../recipes/IsArrayable';
|
|
2
|
+
import { IsTree } from '../recipes/IsTree';
|
|
3
|
+
/**
|
|
4
|
+
* Loop over all the nodes in a tree starting from left and apply a callback for each
|
|
5
|
+
* @param tree
|
|
6
|
+
* @param callback
|
|
7
|
+
*/
|
|
8
|
+
export declare const parseTree: (tree: IsTree, callback: forEachCallback) => IsTree;
|