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.
- package/README.md +2525 -2525
- package/browser/collect-your-stuff.js +22766 -22761
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +36 -36
- package/dist/collections/arrayable/ArrayElement.js +64 -64
- package/dist/collections/arrayable/Arrayable.d.ts +108 -108
- package/dist/collections/arrayable/Arrayable.js +188 -188
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +46 -46
- package/dist/collections/doubly-linked-list/DoubleLinker.js +69 -69
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +113 -113
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +274 -269
- package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -1
- package/dist/collections/linked-list/LinkedList.d.ts +109 -109
- package/dist/collections/linked-list/LinkedList.js +233 -233
- package/dist/collections/linked-list/Linker.d.ts +43 -43
- package/dist/collections/linked-list/Linker.js +80 -80
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +135 -135
- package/dist/collections/linked-tree-list/LinkedTreeList.js +252 -252
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +63 -63
- package/dist/collections/linked-tree-list/TreeLinker.js +79 -79
- package/dist/collections/queue/Queue.d.ts +63 -63
- package/dist/collections/queue/Queue.js +130 -130
- package/dist/collections/queue/Queueable.d.ts +77 -77
- package/dist/collections/queue/Queueable.js +141 -141
- package/dist/collections/stack/Stack.d.ts +63 -63
- package/dist/collections/stack/Stack.js +106 -106
- package/dist/collections/stack/Stackable.d.ts +56 -56
- package/dist/collections/stack/Stackable.js +83 -83
- package/dist/main.d.ts +40 -40
- package/dist/main.js +50 -50
- package/dist/recipes/ArrayIterator.d.ts +10 -10
- package/dist/recipes/ArrayIterator.js +29 -29
- package/dist/recipes/DoubleLinkerIterator.d.ts +9 -9
- package/dist/recipes/DoubleLinkerIterator.js +24 -24
- package/dist/recipes/IsArrayable.d.ts +105 -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/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 +9 -9
- package/dist/recipes/LinkerIterator.js +24 -24
- package/dist/recipes/Runnable.d.ts +54 -54
- package/dist/recipes/Runnable.js +68 -68
- package/dist/recipes/TreeLinkerIterator.d.ts +9 -9
- package/dist/recipes/TreeLinkerIterator.js +25 -25
- package/dist/recipes/recipes.d.ts +15 -15
- package/dist/recipes/recipes.js +22 -22
- package/dist/services/parseTree.d.ts +9 -9
- package/dist/services/parseTree.js +24 -24
- package/dist/services/parseTreeNext.d.ts +14 -14
- package/dist/services/parseTreeNext.js +47 -47
- package/dist/services/services.d.ts +13 -13
- package/dist/services/services.js +22 -22
- package/package.json +1 -1
|
@@ -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 {Array} children
|
|
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 {Array} 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,9 +1,9 @@
|
|
|
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
|
-
constructor(current: IsLinker);
|
|
8
|
-
next(value?: any): IteratorResult<IsLinker>;
|
|
9
|
-
}
|
|
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
|
+
constructor(current: IsLinker);
|
|
8
|
+
next(value?: any): IteratorResult<IsLinker>;
|
|
9
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
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
|
-
constructor (current) {
|
|
12
|
-
this.current = current
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
next (value) {
|
|
16
|
-
const result = {
|
|
17
|
-
value: this.current,
|
|
18
|
-
done: !this.current
|
|
19
|
-
}
|
|
20
|
-
this.current = this.current ? this.current.next : null
|
|
21
|
-
return result
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
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
|
+
constructor (current) {
|
|
12
|
+
this.current = current
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
next (value) {
|
|
16
|
+
const result = {
|
|
17
|
+
value: this.current,
|
|
18
|
+
done: !this.current
|
|
19
|
+
}
|
|
20
|
+
this.current = this.current ? this.current.next : null
|
|
21
|
+
return result
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.LinkerIterator = LinkerIterator
|
|
@@ -1,54 +1,54 @@
|
|
|
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
|
|
13
|
-
*/
|
|
14
|
-
export type completeResponse = {
|
|
15
|
-
success: boolean | any;
|
|
16
|
-
error: boolean | any;
|
|
17
|
-
context: any;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Specify a type of class that is Runnable.
|
|
21
|
-
*/
|
|
22
|
-
export interface IsRunnable {
|
|
23
|
-
data: any;
|
|
24
|
-
get task(): Function;
|
|
25
|
-
run(): completeResponse | any;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Identify a class that can be run.
|
|
29
|
-
*/
|
|
30
|
-
export declare class Runnable implements IsRunnable {
|
|
31
|
-
data: any;
|
|
32
|
-
/**
|
|
33
|
-
* Instantiate a Runnable class.
|
|
34
|
-
* @param {*} data
|
|
35
|
-
*/
|
|
36
|
-
constructor(data?: any);
|
|
37
|
-
/**
|
|
38
|
-
* Retrieve the data which should be formed as a task.
|
|
39
|
-
* @return {Function}
|
|
40
|
-
*/
|
|
41
|
-
get task(): Function;
|
|
42
|
-
/**
|
|
43
|
-
* Run the runnable task.
|
|
44
|
-
* @return {*}
|
|
45
|
-
*/
|
|
46
|
-
run(): completeResponse | any;
|
|
47
|
-
/**
|
|
48
|
-
* Check if a given thing is Runnable
|
|
49
|
-
* @memberof Runnable
|
|
50
|
-
* @param {*} thing
|
|
51
|
-
* @return {boolean}
|
|
52
|
-
*/
|
|
53
|
-
static isRunnable(thing: any): boolean;
|
|
54
|
-
}
|
|
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
|
|
13
|
+
*/
|
|
14
|
+
export type completeResponse = {
|
|
15
|
+
success: boolean | any;
|
|
16
|
+
error: boolean | any;
|
|
17
|
+
context: any;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Specify a type of class that is Runnable.
|
|
21
|
+
*/
|
|
22
|
+
export interface IsRunnable {
|
|
23
|
+
data: any;
|
|
24
|
+
get task(): Function;
|
|
25
|
+
run(): completeResponse | any;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Identify a class that can be run.
|
|
29
|
+
*/
|
|
30
|
+
export declare class Runnable implements IsRunnable {
|
|
31
|
+
data: any;
|
|
32
|
+
/**
|
|
33
|
+
* Instantiate a Runnable class.
|
|
34
|
+
* @param {*} data
|
|
35
|
+
*/
|
|
36
|
+
constructor(data?: any);
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve the data which should be formed as a task.
|
|
39
|
+
* @return {Function}
|
|
40
|
+
*/
|
|
41
|
+
get task(): Function;
|
|
42
|
+
/**
|
|
43
|
+
* Run the runnable task.
|
|
44
|
+
* @return {*}
|
|
45
|
+
*/
|
|
46
|
+
run(): completeResponse | any;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a given thing is Runnable
|
|
49
|
+
* @memberof Runnable
|
|
50
|
+
* @param {*} thing
|
|
51
|
+
* @return {boolean}
|
|
52
|
+
*/
|
|
53
|
+
static isRunnable(thing: any): boolean;
|
|
54
|
+
}
|
package/dist/recipes/Runnable.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.Runnable = void 0
|
|
7
|
-
/**
|
|
8
|
-
* @file Runnable class recipe.
|
|
9
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
* @memberOf module:collect-your-stuff
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Identify a class that can be run.
|
|
15
|
-
*/
|
|
16
|
-
class Runnable {
|
|
17
|
-
/**
|
|
18
|
-
* Instantiate a Runnable class.
|
|
19
|
-
* @param {*} data
|
|
20
|
-
*/
|
|
21
|
-
constructor (data = null) {
|
|
22
|
-
this.data = null
|
|
23
|
-
this.data = data
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Retrieve the data which should be formed as a task.
|
|
28
|
-
* @return {Function}
|
|
29
|
-
*/
|
|
30
|
-
get task () {
|
|
31
|
-
if (typeof this.data === 'function') {
|
|
32
|
-
return this.data
|
|
33
|
-
}
|
|
34
|
-
return () => this.data
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Run the runnable task.
|
|
39
|
-
* @return {*}
|
|
40
|
-
*/
|
|
41
|
-
run () {
|
|
42
|
-
return this.task()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Check if a given thing is Runnable
|
|
47
|
-
* @memberof Runnable
|
|
48
|
-
* @param {*} thing
|
|
49
|
-
* @return {boolean}
|
|
50
|
-
*/
|
|
51
|
-
static isRunnable (thing) {
|
|
52
|
-
if (typeof thing === 'undefined') {
|
|
53
|
-
// No argument past, this class is runnable
|
|
54
|
-
return this instanceof Runnable
|
|
55
|
-
}
|
|
56
|
-
if (typeof thing !== 'object') {
|
|
57
|
-
// It is not even an object, so cannot be a class instance
|
|
58
|
-
return false
|
|
59
|
-
}
|
|
60
|
-
if (typeof thing.task !== 'function') {
|
|
61
|
-
// It does not have a task getter that returns a function
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
// Finally, it has a runnable 'run' method. This method should return the result of running the task.
|
|
65
|
-
return typeof thing.run === 'function'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.Runnable = Runnable
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.Runnable = void 0
|
|
7
|
+
/**
|
|
8
|
+
* @file Runnable class recipe.
|
|
9
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
* @memberOf module:collect-your-stuff
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Identify a class that can be run.
|
|
15
|
+
*/
|
|
16
|
+
class Runnable {
|
|
17
|
+
/**
|
|
18
|
+
* Instantiate a Runnable class.
|
|
19
|
+
* @param {*} data
|
|
20
|
+
*/
|
|
21
|
+
constructor (data = null) {
|
|
22
|
+
this.data = null
|
|
23
|
+
this.data = data
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Retrieve the data which should be formed as a task.
|
|
28
|
+
* @return {Function}
|
|
29
|
+
*/
|
|
30
|
+
get task () {
|
|
31
|
+
if (typeof this.data === 'function') {
|
|
32
|
+
return this.data
|
|
33
|
+
}
|
|
34
|
+
return () => this.data
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Run the runnable task.
|
|
39
|
+
* @return {*}
|
|
40
|
+
*/
|
|
41
|
+
run () {
|
|
42
|
+
return this.task()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Check if a given thing is Runnable
|
|
47
|
+
* @memberof Runnable
|
|
48
|
+
* @param {*} thing
|
|
49
|
+
* @return {boolean}
|
|
50
|
+
*/
|
|
51
|
+
static isRunnable (thing) {
|
|
52
|
+
if (typeof thing === 'undefined') {
|
|
53
|
+
// No argument past, this class is runnable
|
|
54
|
+
return this instanceof Runnable
|
|
55
|
+
}
|
|
56
|
+
if (typeof thing !== 'object') {
|
|
57
|
+
// It is not even an object, so cannot be a class instance
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
if (typeof thing.task !== 'function') {
|
|
61
|
+
// It does not have a task getter that returns a function
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
// Finally, it has a runnable 'run' method. This method should return the result of running the task.
|
|
65
|
+
return typeof thing.run === 'function'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Runnable = Runnable
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
constructor(current: IsTreeNode);
|
|
8
|
-
next(value?: any): IteratorResult<IsTreeNode>;
|
|
9
|
-
}
|
|
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
|
+
constructor(current: IsTreeNode);
|
|
8
|
+
next(value?: any): IteratorResult<IsTreeNode>;
|
|
9
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.TreeLinkerIterator = void 0
|
|
7
|
-
var _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
|
-
constructor (current) {
|
|
13
|
-
this.current = current
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
next (value) {
|
|
17
|
-
const result = {
|
|
18
|
-
value: this.current,
|
|
19
|
-
done: !this.current
|
|
20
|
-
}
|
|
21
|
-
this.current = (0, _parseTreeNext.parseTreeNext)(this.current)
|
|
22
|
-
return result
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.TreeLinkerIterator = TreeLinkerIterator
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.TreeLinkerIterator = void 0
|
|
7
|
+
var _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
|
+
constructor (current) {
|
|
13
|
+
this.current = current
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
next (value) {
|
|
17
|
+
const result = {
|
|
18
|
+
value: this.current,
|
|
19
|
+
done: !this.current
|
|
20
|
+
}
|
|
21
|
+
this.current = (0, _parseTreeNext.parseTreeNext)(this.current)
|
|
22
|
+
return result
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TreeLinkerIterator = TreeLinkerIterator
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
6
|
-
*/
|
|
7
|
-
import { ArrayIterator } from './ArrayIterator';
|
|
8
|
-
import { Runnable } from './Runnable';
|
|
9
|
-
/**
|
|
10
|
-
* List of class declarations that can be used to specify attributes for a style of object / class.
|
|
11
|
-
*/
|
|
12
|
-
export declare const recipes: {
|
|
13
|
-
ArrayIterator: typeof ArrayIterator;
|
|
14
|
-
Runnable: typeof Runnable;
|
|
15
|
-
};
|
|
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
|
|
6
|
+
*/
|
|
7
|
+
import { ArrayIterator } from './ArrayIterator';
|
|
8
|
+
import { Runnable } from './Runnable';
|
|
9
|
+
/**
|
|
10
|
+
* List of class declarations that can be used to specify attributes for a style of object / class.
|
|
11
|
+
*/
|
|
12
|
+
export declare const recipes: {
|
|
13
|
+
ArrayIterator: typeof ArrayIterator;
|
|
14
|
+
Runnable: typeof Runnable;
|
|
15
|
+
};
|
package/dist/recipes/recipes.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.recipes = void 0
|
|
7
|
-
var _ArrayIterator = require('./ArrayIterator')
|
|
8
|
-
var _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
|
+
var _ArrayIterator = require('./ArrayIterator')
|
|
8
|
+
var _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,9 +1,9 @@
|
|
|
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 {IsArrayable<IsTreeNode>} tree
|
|
6
|
-
* @param {forEachCallback} callback
|
|
7
|
-
* @returns {IsArrayable<IsTreeNode>}
|
|
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 {IsArrayable<IsTreeNode>} tree
|
|
6
|
+
* @param {forEachCallback} callback
|
|
7
|
+
* @returns {IsArrayable<IsTreeNode>}
|
|
8
|
+
*/
|
|
9
|
+
export declare const parseTree: (tree: IsTree, callback: forEachCallback) => IsTree;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.parseTree = void 0
|
|
7
|
-
var _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
|
+
var _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,14 +1,14 @@
|
|
|
1
|
-
import { IsTreeNode } from '../recipes/IsTreeNode';
|
|
2
|
-
/**
|
|
3
|
-
* Be able to parse over every node in a tree.
|
|
4
|
-
* 1. Start at root (get root parent)
|
|
5
|
-
* 2. Get first child (repeat until no children)
|
|
6
|
-
* 3. Check next child
|
|
7
|
-
* 4. Repeat 2
|
|
8
|
-
* 5. Repeat 3
|
|
9
|
-
* 6. If no next child, return to parent and repeat 3
|
|
10
|
-
* 7. Stop at root (next is null and parent is null
|
|
11
|
-
* @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
|
|
12
|
-
* @returns {IsTreeNode|null}
|
|
13
|
-
*/
|
|
14
|
-
export declare const parseTreeNext: (treeNode: IsTreeNode) => IsTreeNode | null;
|
|
1
|
+
import { IsTreeNode } from '../recipes/IsTreeNode';
|
|
2
|
+
/**
|
|
3
|
+
* Be able to parse over every node in a tree.
|
|
4
|
+
* 1. Start at root (get root parent)
|
|
5
|
+
* 2. Get first child (repeat until no children)
|
|
6
|
+
* 3. Check next child
|
|
7
|
+
* 4. Repeat 2
|
|
8
|
+
* 5. Repeat 3
|
|
9
|
+
* 6. If no next child, return to parent and repeat 3
|
|
10
|
+
* 7. Stop at root (next is null and parent is null
|
|
11
|
+
* @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
|
|
12
|
+
* @returns {IsTreeNode|null}
|
|
13
|
+
*/
|
|
14
|
+
export declare const parseTreeNext: (treeNode: IsTreeNode) => IsTreeNode | null;
|