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.
Files changed (75) hide show
  1. package/README.md +32 -3241
  2. package/browser/collect-your-stuff.js +1585 -1193
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
  5. package/dist/collections/arrayable/ArrayElement.js +64 -66
  6. package/dist/collections/arrayable/Arrayable.d.ts +107 -122
  7. package/dist/collections/arrayable/Arrayable.js +208 -223
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
  12. package/dist/collections/linked-list/LinkedList.d.ts +110 -126
  13. package/dist/collections/linked-list/LinkedList.js +283 -296
  14. package/dist/collections/linked-list/Linker.d.ts +41 -46
  15. package/dist/collections/linked-list/Linker.js +82 -84
  16. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
  17. package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
  18. package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
  19. package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
  20. package/dist/collections/queue/Queue.d.ts +55 -59
  21. package/dist/collections/queue/Queue.js +114 -119
  22. package/dist/collections/queue/Queueable.d.ts +74 -83
  23. package/dist/collections/queue/Queueable.js +142 -146
  24. package/dist/collections/queue/TaskQueue.d.ts +59 -68
  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 +60 -64
  30. package/dist/collections/stack/Stack.js +122 -127
  31. package/dist/collections/stack/Stackable.d.ts +52 -59
  32. package/dist/collections/stack/Stackable.js +81 -85
  33. package/dist/collections/stack/TaskStack.d.ts +56 -65
  34. package/dist/collections/stack/TaskStack.js +98 -107
  35. package/dist/main.d.ts +4 -5
  36. package/dist/main.js +9 -5
  37. package/dist/main.min.js +1 -1
  38. package/dist/recipes/ArrayIterator.d.ts +20 -20
  39. package/dist/recipes/ArrayIterator.js +39 -39
  40. package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
  41. package/dist/recipes/DoubleLinkerIterator.js +33 -33
  42. package/dist/recipes/IsArrayable.d.ts +85 -105
  43. package/dist/recipes/IsArrayable.js +5 -5
  44. package/dist/recipes/IsDoubleLinker.d.ts +14 -14
  45. package/dist/recipes/IsDoubleLinker.js +5 -5
  46. package/dist/recipes/IsElement.d.ts +14 -14
  47. package/dist/recipes/IsElement.js +5 -5
  48. package/dist/recipes/IsLinker.d.ts +10 -10
  49. package/dist/recipes/IsLinker.js +5 -5
  50. package/dist/recipes/IsQueue.d.ts +32 -37
  51. package/dist/recipes/IsQueue.js +5 -5
  52. package/dist/recipes/IsScopedCollection.d.ts +27 -0
  53. package/dist/recipes/IsScopedCollection.js +5 -0
  54. package/dist/recipes/IsScopedCollection.min.js +1 -0
  55. package/dist/recipes/IsStack.d.ts +31 -36
  56. package/dist/recipes/IsStack.js +5 -5
  57. package/dist/recipes/IsTree.d.ts +11 -11
  58. package/dist/recipes/IsTree.js +5 -5
  59. package/dist/recipes/IsTreeNode.d.ts +29 -29
  60. package/dist/recipes/IsTreeNode.js +5 -5
  61. package/dist/recipes/LinkerIterator.d.ts +18 -18
  62. package/dist/recipes/LinkerIterator.js +33 -33
  63. package/dist/recipes/Runnable.d.ts +42 -55
  64. package/dist/recipes/Runnable.js +63 -69
  65. package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
  66. package/dist/recipes/TreeLinkerIterator.js +36 -36
  67. package/dist/recipes/recipes.d.ts +12 -15
  68. package/dist/recipes/recipes.js +19 -22
  69. package/dist/services/parseTree.d.ts +8 -9
  70. package/dist/services/parseTree.js +23 -24
  71. package/dist/services/parseTreeNext.d.ts +16 -17
  72. package/dist/services/parseTreeNext.js +41 -42
  73. package/dist/services/services.d.ts +10 -13
  74. package/dist/services/services.js +19 -22
  75. package/package.json +4 -4
@@ -1,24 +1,23 @@
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
+ 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
@@ -1,17 +1,16 @@
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
- * A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
12
- * parsing stays within the nodes whose parent is the boundary (and everything below them).
13
- * @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
14
- * @param {IsTreeNode|null} [boundaryParent] The parent of the nodes to stay within, null for the nodes at the top of a tree. When it is not given the whole tree is parsed.
15
- * @returns {IsTreeNode|null}
16
- */
17
- export declare const parseTreeNext: (treeNode: IsTreeNode, boundaryParent?: IsTreeNode | null) => 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
+ * A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
12
+ * parsing stays within the nodes whose parent is the boundary (and everything below them).
13
+ * @param treeNode Provide a node in a tree and get the next node (left-first approach)
14
+ * @param boundaryParent The parent of the nodes to stay within, null for the nodes at the top of a tree. When it is not given the whole tree is parsed.
15
+ */
16
+ export declare const parseTreeNext: (treeNode: IsTreeNode, boundaryParent?: IsTreeNode | null) => IsTreeNode | null;
@@ -1,42 +1,41 @@
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
- * A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
17
- * parsing stays within the nodes whose parent is the boundary (and everything below them).
18
- * @param {IsTreeNode} treeNode Provide a node in a tree and get the next node (left-first approach)
19
- * @param {IsTreeNode|null} [boundaryParent] The parent of the nodes to stay within, null for the nodes at the top of a tree. When it is not given the whole tree is parsed.
20
- * @returns {IsTreeNode|null}
21
- */
22
- const parseTreeNext = (treeNode, boundaryParent) => {
23
- if (!treeNode) {
24
- return null
25
- }
26
- if (treeNode.children && treeNode.children.length) {
27
- return treeNode.children.first
28
- }
29
- if (treeNode.next) {
30
- return treeNode.next
31
- }
32
- // Nothing more below or beside this node, so go back up until there is a node which has a next (or the boundary)
33
- let parent = treeNode.parent
34
- while (parent && parent !== boundaryParent) {
35
- if (parent.next) {
36
- return parent.next
37
- }
38
- parent = parent.parent
39
- }
40
- return null
41
- }
42
- 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
+ * A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
17
+ * parsing stays within the nodes whose parent is the boundary (and everything below them).
18
+ * @param treeNode Provide a node in a tree and get the next node (left-first approach)
19
+ * @param boundaryParent The parent of the nodes to stay within, null for the nodes at the top of a tree. When it is not given the whole tree is parsed.
20
+ */
21
+ const parseTreeNext = (treeNode, boundaryParent) => {
22
+ if (!treeNode) {
23
+ return null
24
+ }
25
+ if (treeNode.children && treeNode.children.length) {
26
+ return treeNode.children.first
27
+ }
28
+ if (treeNode.next) {
29
+ return treeNode.next
30
+ }
31
+ // Nothing more below or beside this node, so go back up until there is a node which has a next (or the boundary)
32
+ let parent = treeNode.parent
33
+ while (parent && parent !== boundaryParent) {
34
+ if (parent.next) {
35
+ return parent.next
36
+ }
37
+ parent = parent.parent
38
+ }
39
+ return null
40
+ }
41
+ exports.parseTreeNext = parseTreeNext
@@ -1,13 +1,10 @@
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("../main").IsTree, callback: import("../main").forEachCallback) => import("../main").IsTree;
12
- parseTreeNext: (treeNode: import("../main").IsTreeNode, boundaryParent?: import("../main").IsTreeNode | null) => import("../main").IsTreeNode | null;
13
- };
1
+ /**
2
+ * some useful resources when working with collections.
3
+ */
4
+ /**
5
+ * List helpful functions when dealing with collections.
6
+ */
7
+ export declare const services: {
8
+ parseTree: (tree: import("../main").IsTree, callback: import("../main").forEachCallback) => import("../main").IsTree;
9
+ parseTreeNext: (treeNode: import("../main").IsTreeNode, boundaryParent?: import("../main").IsTreeNode | null) => import("../main").IsTreeNode | null;
10
+ };
@@ -1,22 +1,19 @@
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
+ const _parseTree = require('./parseTree')
8
+ const _parseTreeNext = require('./parseTreeNext')
9
+ /**
10
+ * some useful resources when working with collections.
11
+ */
12
+
13
+ /**
14
+ * List helpful functions when dealing with collections.
15
+ */
16
+ const services = exports.services = {
17
+ parseTree: _parseTree.parseTree,
18
+ parseTreeNext: _parseTreeNext.parseTreeNext
19
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "collect-your-stuff",
3
3
  "description": "Use a variety of collections to collect your stuff when building code.",
4
- "version": "2.1.1",
4
+ "version": "2.2.0",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
7
7
  "author": "Joshua Heagle",
@@ -16,8 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "gulp build",
18
18
  "dev": "gulp",
19
- "htmldocs": "jsdoc -R MAIN.md -c ./.jsdoc.conf.js -d docs",
20
- "readme": "gulp readme",
19
+ "docs": "gulp docs",
21
20
  "test": "gulp testFull",
22
21
  "typecheck": "tsc --noEmit -p tsconfig.json",
23
22
  "test:quick": "gulp testQuick",
@@ -25,7 +24,8 @@
25
24
  "watch:test": "gulp watchTest"
26
25
  },
27
26
  "devDependencies": {
28
- "js-build-tools": "^4.1.1"
27
+ "js-build-tools": "^5.3.2",
28
+ "typedoc": "^0.28.20"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",