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,47 +1,47 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.parseTreeNext = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Be able to parse over every node in a tree.
|
|
9
|
-
* 1. Start at root (get root parent)
|
|
10
|
-
* 2. Get first child (repeat until no children)
|
|
11
|
-
* 3. Check next child
|
|
12
|
-
* 4. Repeat 2
|
|
13
|
-
* 5. Repeat 3
|
|
14
|
-
* 6. If no next child, return to parent and repeat 3
|
|
15
|
-
* 7. Stop at root (next is null and parent is null
|
|
16
|
-
* @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
|
|
17
|
-
* @returns {IsTreeNode|null}
|
|
18
|
-
*/
|
|
19
|
-
const parseTreeNext = treeNode => {
|
|
20
|
-
if (!treeNode) {
|
|
21
|
-
return null
|
|
22
|
-
}
|
|
23
|
-
let test = null
|
|
24
|
-
if (treeNode.children && treeNode.children.length) {
|
|
25
|
-
// Go down the left side of the tree
|
|
26
|
-
test = treeNode.children.first
|
|
27
|
-
}
|
|
28
|
-
if (!test) {
|
|
29
|
-
// Reached the bottom, go the next node on the right
|
|
30
|
-
test = treeNode.next
|
|
31
|
-
}
|
|
32
|
-
if (!test && treeNode.parent) {
|
|
33
|
-
// No more child nodes, return to parent and check parent sibling on the right
|
|
34
|
-
let parentNext = treeNode.parent.next
|
|
35
|
-
let parent = treeNode.parent
|
|
36
|
-
while (parent && !parentNext) {
|
|
37
|
-
parentNext = parent.next
|
|
38
|
-
// Keep checking parent next, until there are no more parents, or we find the parent sibling
|
|
39
|
-
parent = parent.parent
|
|
40
|
-
}
|
|
41
|
-
// This may be the parent sibling, or it could be null indicating we are done
|
|
42
|
-
test = parentNext
|
|
43
|
-
}
|
|
44
|
-
// Finally, either use the node we found, or it may be null
|
|
45
|
-
return test
|
|
46
|
-
}
|
|
47
|
-
exports.parseTreeNext = parseTreeNext
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.parseTreeNext = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Be able to parse over every node in a tree.
|
|
9
|
+
* 1. Start at root (get root parent)
|
|
10
|
+
* 2. Get first child (repeat until no children)
|
|
11
|
+
* 3. Check next child
|
|
12
|
+
* 4. Repeat 2
|
|
13
|
+
* 5. Repeat 3
|
|
14
|
+
* 6. If no next child, return to parent and repeat 3
|
|
15
|
+
* 7. Stop at root (next is null and parent is null
|
|
16
|
+
* @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
|
|
17
|
+
* @returns {IsTreeNode|null}
|
|
18
|
+
*/
|
|
19
|
+
const parseTreeNext = treeNode => {
|
|
20
|
+
if (!treeNode) {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
let test = null
|
|
24
|
+
if (treeNode.children && treeNode.children.length) {
|
|
25
|
+
// Go down the left side of the tree
|
|
26
|
+
test = treeNode.children.first
|
|
27
|
+
}
|
|
28
|
+
if (!test) {
|
|
29
|
+
// Reached the bottom, go the next node on the right
|
|
30
|
+
test = treeNode.next
|
|
31
|
+
}
|
|
32
|
+
if (!test && treeNode.parent) {
|
|
33
|
+
// No more child nodes, return to parent and check parent sibling on the right
|
|
34
|
+
let parentNext = treeNode.parent.next
|
|
35
|
+
let parent = treeNode.parent
|
|
36
|
+
while (parent && !parentNext) {
|
|
37
|
+
parentNext = parent.next
|
|
38
|
+
// Keep checking parent next, until there are no more parents, or we find the parent sibling
|
|
39
|
+
parent = parent.parent
|
|
40
|
+
}
|
|
41
|
+
// This may be the parent sibling, or it could be null indicating we are done
|
|
42
|
+
test = parentNext
|
|
43
|
+
}
|
|
44
|
+
// Finally, either use the node we found, or it may be null
|
|
45
|
+
return test
|
|
46
|
+
}
|
|
47
|
+
exports.parseTreeNext = parseTreeNext
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file some useful resources when working with collections.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.1.0
|
|
5
|
-
* @memberOf module:collect-your-stuff
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* List helpful functions when dealing with collections.
|
|
9
|
-
*/
|
|
10
|
-
export declare const services: {
|
|
11
|
-
parseTree: (tree: import("../recipes/IsTree").IsTree, callback: import("../recipes/IsArrayable").forEachCallback) => import("../recipes/IsTree").IsTree;
|
|
12
|
-
parseTreeNext: (treeNode: import("../recipes/IsTreeNode").IsTreeNode) => import("../recipes/IsTreeNode").IsTreeNode | null;
|
|
13
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @file some useful resources when working with collections.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.1.0
|
|
5
|
+
* @memberOf module:collect-your-stuff
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* List helpful functions when dealing with collections.
|
|
9
|
+
*/
|
|
10
|
+
export declare const services: {
|
|
11
|
+
parseTree: (tree: import("../recipes/IsTree").IsTree, callback: import("../recipes/IsArrayable").forEachCallback) => import("../recipes/IsTree").IsTree;
|
|
12
|
+
parseTreeNext: (treeNode: import("../recipes/IsTreeNode").IsTreeNode) => import("../recipes/IsTreeNode").IsTreeNode | null;
|
|
13
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.services = void 0
|
|
7
|
-
var _parseTree = require('./parseTree')
|
|
8
|
-
var _parseTreeNext = require('./parseTreeNext')
|
|
9
|
-
/**
|
|
10
|
-
* @file some useful resources when working with collections.
|
|
11
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
-
* @version 1.1.0
|
|
13
|
-
* @memberOf module:collect-your-stuff
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* List helpful functions when dealing with collections.
|
|
18
|
-
*/
|
|
19
|
-
const services = exports.services = {
|
|
20
|
-
parseTree: _parseTree.parseTree,
|
|
21
|
-
parseTreeNext: _parseTreeNext.parseTreeNext
|
|
22
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.services = void 0
|
|
7
|
+
var _parseTree = require('./parseTree')
|
|
8
|
+
var _parseTreeNext = require('./parseTreeNext')
|
|
9
|
+
/**
|
|
10
|
+
* @file some useful resources when working with collections.
|
|
11
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
+
* @version 1.1.0
|
|
13
|
+
* @memberOf module:collect-your-stuff
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* List helpful functions when dealing with collections.
|
|
18
|
+
*/
|
|
19
|
+
const services = exports.services = {
|
|
20
|
+
parseTree: _parseTree.parseTree,
|
|
21
|
+
parseTreeNext: _parseTreeNext.parseTreeNext
|
|
22
|
+
}
|
package/package.json
CHANGED