collect-your-stuff 1.2.9 → 1.3.2
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 +802 -77
- package/dist/collections/arrayable/ArrayElement.d.ts +2 -0
- package/dist/collections/arrayable/ArrayElement.js +4 -2
- package/dist/collections/arrayable/ArrayElement.min.js +1 -1
- package/dist/collections/arrayable/Arrayable.d.ts +25 -11
- package/dist/collections/arrayable/Arrayable.js +37 -12
- package/dist/collections/arrayable/Arrayable.min.js +1 -1
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +5 -1
- package/dist/collections/doubly-linked-list/DoubleLinker.js +5 -1
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +11 -5
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +43 -25
- package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -1
- package/dist/collections/linked-list/LinkedList.d.ts +13 -7
- package/dist/collections/linked-list/LinkedList.js +42 -23
- package/dist/collections/linked-list/LinkedList.min.js +1 -1
- package/dist/collections/linked-list/Linker.d.ts +5 -2
- package/dist/collections/linked-list/Linker.js +9 -5
- package/dist/collections/linked-list/Linker.min.js +1 -1
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +7 -1
- package/dist/collections/linked-tree-list/LinkedTreeList.js +6 -1
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +7 -1
- package/dist/collections/linked-tree-list/TreeLinker.js +7 -1
- package/dist/collections/queue/Queue.d.ts +6 -3
- package/dist/collections/queue/Queue.js +23 -18
- package/dist/collections/queue/Queue.min.js +1 -1
- package/dist/collections/queue/Queueable.d.ts +10 -4
- package/dist/collections/queue/Queueable.js +11 -6
- package/dist/collections/queue/Queueable.min.js +1 -1
- package/dist/collections/stack/Stack.d.ts +4 -3
- package/dist/collections/stack/Stack.js +4 -4
- package/dist/collections/stack/Stack.min.js +1 -1
- package/dist/collections/stack/Stackable.d.ts +4 -1
- package/dist/collections/stack/Stackable.js +7 -5
- package/dist/collections/stack/Stackable.min.js +1 -1
- package/dist/main.d.ts +26 -3
- package/dist/main.js +101 -1
- package/dist/main.min.js +1 -1
- package/dist/recipes/ArrayIterator.d.ts +10 -0
- package/dist/recipes/ArrayIterator.js +10 -0
- package/dist/recipes/DoubleLinkerIterator.d.ts +9 -0
- package/dist/recipes/DoubleLinkerIterator.js +9 -0
- package/dist/recipes/LinkerIterator.d.ts +9 -0
- package/dist/recipes/LinkerIterator.js +9 -0
- package/dist/recipes/Runnable.d.ts +3 -2
- package/dist/recipes/Runnable.js +3 -2
- package/dist/recipes/TreeLinkerIterator.d.ts +9 -0
- package/dist/recipes/TreeLinkerIterator.js +9 -0
- package/dist/services/services.d.ts +2 -2
- package/package.json +2 -1
|
@@ -12,7 +12,7 @@ var _Linker = require('../linked-list/Linker')
|
|
|
12
12
|
class Stackable {
|
|
13
13
|
/**
|
|
14
14
|
* Create a stackable item that can be used in a stack.
|
|
15
|
-
* @param {Object} [stackData={}]
|
|
15
|
+
* @param {Object} [stackData={}] The settings for the new stackable.
|
|
16
16
|
* @param {*} [stackData.task=null] The data to be stored in this stackable
|
|
17
17
|
* @param {Stackable|null} [stackData.next=null] The reference to the next stackable if any
|
|
18
18
|
* @param {boolean|Function} [stackData.ready=false] Indicate if the stackable is ready to run
|
|
@@ -22,7 +22,9 @@ class Stackable {
|
|
|
22
22
|
next = null,
|
|
23
23
|
ready = false
|
|
24
24
|
} = {}) {
|
|
25
|
+
/** The task (or data) this stackable holds. */
|
|
25
26
|
this.data = null
|
|
27
|
+
/** The stackable below this one, or null when this is the bottom. */
|
|
26
28
|
this.next = null
|
|
27
29
|
this.classType = Stackable
|
|
28
30
|
this.data = task
|
|
@@ -56,8 +58,8 @@ class Stackable {
|
|
|
56
58
|
*/
|
|
57
59
|
exports.Stackable = Stackable
|
|
58
60
|
Stackable.make = (stackable, classType = Stackable) => {
|
|
59
|
-
if (typeof stackable !== 'object') {
|
|
60
|
-
// It is not an object, so instantiate the Stackable with stackable as the data
|
|
61
|
+
if (stackable === null || typeof stackable !== 'object') {
|
|
62
|
+
// It is not an object (or it is null), so instantiate the Stackable with stackable as the data
|
|
61
63
|
return new classType({
|
|
62
64
|
task: stackable
|
|
63
65
|
})
|
|
@@ -66,13 +68,13 @@ Stackable.make = (stackable, classType = Stackable) => {
|
|
|
66
68
|
// Already valid Stackable, return as-is
|
|
67
69
|
return stackable
|
|
68
70
|
}
|
|
69
|
-
if (!stackable
|
|
71
|
+
if (!('task' in stackable)) {
|
|
70
72
|
stackable = {
|
|
71
73
|
task: stackable
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
// Create the new node as the configured stackableClass
|
|
75
|
-
return new
|
|
77
|
+
return new classType(stackable)
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* Convert an array into Stackable instances, return the head and tail Stackables.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stackable=void 0;var _Linker=require("../linked-list/Linker");class Stackable{constructor({task:t=null,next:a=null,ready:e=!1}={}){this.data=null,this.next=null,this.classType=Stackable,this.data=t,this.next=a}get task(){return"function"==typeof this.data?this.data:()=>this.data}run(){return this.task()}}exports.Stackable=Stackable,Stackable.make=(t,a=Stackable)=>"object"!=typeof t?new a({task:t}):t.classType?t:(t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stackable=void 0;var _Linker=require("../linked-list/Linker");class Stackable{constructor({task:t=null,next:a=null,ready:e=!1}={}){this.data=null,this.next=null,this.classType=Stackable,this.data=t,this.next=a}get task(){return"function"==typeof this.data?this.data:()=>this.data}run(){return this.task()}}exports.Stackable=Stackable,Stackable.make=(t,a=Stackable)=>null===t||"object"!=typeof t?new a({task:t}):t.classType?t:("task"in t||(t={task:t}),new a(t)),Stackable.fromArray=(t=[],a=Stackable)=>_Linker.Linker.fromArray(t,a);
|
package/dist/main.d.ts
CHANGED
|
@@ -6,35 +6,58 @@
|
|
|
6
6
|
* @module collect-your-stuff
|
|
7
7
|
*/
|
|
8
8
|
import 'core-js/stable';
|
|
9
|
+
import { ArrayElement } from './collections/arrayable/ArrayElement';
|
|
9
10
|
import { Arrayable } from './collections/arrayable/Arrayable';
|
|
11
|
+
import { DoubleLinker } from './collections/doubly-linked-list/DoubleLinker';
|
|
10
12
|
import { DoublyLinkedList } from './collections/doubly-linked-list/DoublyLinkedList';
|
|
13
|
+
import { Linker } from './collections/linked-list/Linker';
|
|
11
14
|
import { LinkedList } from './collections/linked-list/LinkedList';
|
|
15
|
+
import { TreeLinker } from './collections/linked-tree-list/TreeLinker';
|
|
12
16
|
import { LinkedTreeList } from './collections/linked-tree-list/LinkedTreeList';
|
|
17
|
+
import { Queueable } from './collections/queue/Queueable';
|
|
13
18
|
import { Queue } from './collections/queue/Queue';
|
|
19
|
+
import { Stackable } from './collections/stack/Stackable';
|
|
14
20
|
import { Stack } from './collections/stack/Stack';
|
|
21
|
+
import { recipes } from './recipes/recipes';
|
|
22
|
+
import { services } from './services/services';
|
|
15
23
|
/**
|
|
16
24
|
* TODO:
|
|
17
25
|
* 1. Create binary tree. Use the tree, but it has a limit of only two children per parent, and when adding / removing sort is applied. Add sort function in fromArray
|
|
18
26
|
* 2. Create a heap (both min and max heap variants) which is similar to binary tree in structure, but tree having its min / max value as root. and it must insert on the left-most lowest level, and removes from root. Be able to easily swap nodes to ensure min / max ordering.
|
|
19
27
|
* 3. Create a graph type which can have directional and undirectional variants for linking nodes
|
|
20
28
|
*/
|
|
29
|
+
export { ArrayElement, Arrayable, DoubleLinker, DoublyLinkedList, Linker, LinkedList, TreeLinker, LinkedTreeList, Queueable, Queue, Stackable, Stack, recipes, services };
|
|
30
|
+
export type { IsArrayable, forEachCallback } from './recipes/IsArrayable';
|
|
31
|
+
export type { IsDoubleLinker } from './recipes/IsDoubleLinker';
|
|
32
|
+
export type { IsElement } from './recipes/IsElement';
|
|
33
|
+
export type { IsLinker } from './recipes/IsLinker';
|
|
34
|
+
export type { IsTree } from './recipes/IsTree';
|
|
35
|
+
export type { IsTreeNode } from './recipes/IsTreeNode';
|
|
36
|
+
export type { IsRunnable, completeResponse } from './recipes/Runnable';
|
|
21
37
|
/**
|
|
22
|
-
* All methods exported from this module are encapsulated within collect-your-stuff
|
|
38
|
+
* All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
|
|
39
|
+
* set of classes as the named exports).
|
|
23
40
|
*/
|
|
24
41
|
declare const collectYourStuff: {
|
|
42
|
+
ArrayElement: typeof ArrayElement;
|
|
25
43
|
Arrayable: typeof Arrayable;
|
|
44
|
+
DoubleLinker: typeof DoubleLinker;
|
|
26
45
|
DoublyLinkedList: typeof DoublyLinkedList;
|
|
46
|
+
Linker: typeof Linker;
|
|
27
47
|
LinkedList: typeof LinkedList;
|
|
48
|
+
TreeLinker: typeof TreeLinker;
|
|
28
49
|
LinkedTreeList: typeof LinkedTreeList;
|
|
50
|
+
Queueable: typeof Queueable;
|
|
29
51
|
Queue: typeof Queue;
|
|
52
|
+
Stackable: typeof Stackable;
|
|
30
53
|
Stack: typeof Stack;
|
|
31
54
|
recipes: {
|
|
32
55
|
ArrayIterator: typeof import("./recipes/ArrayIterator").ArrayIterator;
|
|
33
56
|
Runnable: typeof import("./recipes/Runnable").Runnable;
|
|
34
57
|
};
|
|
35
58
|
services: {
|
|
36
|
-
parseTree: (tree: import("./
|
|
37
|
-
parseTreeNext: (treeNode: import("./
|
|
59
|
+
parseTree: (tree: import("./main").IsTree, callback: import("./main").forEachCallback) => import("./main").IsTree;
|
|
60
|
+
parseTreeNext: (treeNode: import("./main").IsTreeNode) => import("./main").IsTreeNode | null;
|
|
38
61
|
};
|
|
39
62
|
};
|
|
40
63
|
export default collectYourStuff;
|
package/dist/main.js
CHANGED
|
@@ -3,13 +3,103 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
})
|
|
6
|
+
Object.defineProperty(exports, 'ArrayElement', {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ArrayElement.ArrayElement
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
Object.defineProperty(exports, 'Arrayable', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Arrayable.Arrayable
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
Object.defineProperty(exports, 'DoubleLinker', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _DoubleLinker.DoubleLinker
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
Object.defineProperty(exports, 'DoublyLinkedList', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _DoublyLinkedList.DoublyLinkedList
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
Object.defineProperty(exports, 'LinkedList', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _LinkedList.LinkedList
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
Object.defineProperty(exports, 'LinkedTreeList', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _LinkedTreeList.LinkedTreeList
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
Object.defineProperty(exports, 'Linker', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _Linker.Linker
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
Object.defineProperty(exports, 'Queue', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _Queue.Queue
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
Object.defineProperty(exports, 'Queueable', {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _Queueable.Queueable
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
Object.defineProperty(exports, 'Stack', {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _Stack.Stack
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
Object.defineProperty(exports, 'Stackable', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _Stackable.Stackable
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
Object.defineProperty(exports, 'TreeLinker', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _TreeLinker.TreeLinker
|
|
76
|
+
}
|
|
77
|
+
})
|
|
6
78
|
exports.default = void 0
|
|
79
|
+
Object.defineProperty(exports, 'recipes', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _recipes.recipes
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
Object.defineProperty(exports, 'services', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _services.services
|
|
89
|
+
}
|
|
90
|
+
})
|
|
7
91
|
require('core-js/stable')
|
|
92
|
+
var _ArrayElement = require('./collections/arrayable/ArrayElement')
|
|
8
93
|
var _Arrayable = require('./collections/arrayable/Arrayable')
|
|
94
|
+
var _DoubleLinker = require('./collections/doubly-linked-list/DoubleLinker')
|
|
9
95
|
var _DoublyLinkedList = require('./collections/doubly-linked-list/DoublyLinkedList')
|
|
96
|
+
var _Linker = require('./collections/linked-list/Linker')
|
|
10
97
|
var _LinkedList = require('./collections/linked-list/LinkedList')
|
|
98
|
+
var _TreeLinker = require('./collections/linked-tree-list/TreeLinker')
|
|
11
99
|
var _LinkedTreeList = require('./collections/linked-tree-list/LinkedTreeList')
|
|
100
|
+
var _Queueable = require('./collections/queue/Queueable')
|
|
12
101
|
var _Queue = require('./collections/queue/Queue')
|
|
102
|
+
var _Stackable = require('./collections/stack/Stackable')
|
|
13
103
|
var _Stack = require('./collections/stack/Stack')
|
|
14
104
|
var _recipes = require('./recipes/recipes')
|
|
15
105
|
var _services = require('./services/services')
|
|
@@ -27,15 +117,25 @@ var _services = require('./services/services')
|
|
|
27
117
|
* 2. Create a heap (both min and max heap variants) which is similar to binary tree in structure, but tree having its min / max value as root. and it must insert on the left-most lowest level, and removes from root. Be able to easily swap nodes to ensure min / max ordering.
|
|
28
118
|
* 3. Create a graph type which can have directional and undirectional variants for linking nodes
|
|
29
119
|
*/
|
|
120
|
+
// Every collection (with the linker / element class it is built from), the recipes and the services are available by
|
|
121
|
+
// name: import { LinkedList, Linker } from 'collect-your-stuff', require('collect-your-stuff').LinkedList ...
|
|
122
|
+
|
|
30
123
|
/**
|
|
31
|
-
* All methods exported from this module are encapsulated within collect-your-stuff
|
|
124
|
+
* All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
|
|
125
|
+
* set of classes as the named exports).
|
|
32
126
|
*/
|
|
33
127
|
const collectYourStuff = {
|
|
128
|
+
ArrayElement: _ArrayElement.ArrayElement,
|
|
34
129
|
Arrayable: _Arrayable.Arrayable,
|
|
130
|
+
DoubleLinker: _DoubleLinker.DoubleLinker,
|
|
35
131
|
DoublyLinkedList: _DoublyLinkedList.DoublyLinkedList,
|
|
132
|
+
Linker: _Linker.Linker,
|
|
36
133
|
LinkedList: _LinkedList.LinkedList,
|
|
134
|
+
TreeLinker: _TreeLinker.TreeLinker,
|
|
37
135
|
LinkedTreeList: _LinkedTreeList.LinkedTreeList,
|
|
136
|
+
Queueable: _Queueable.Queueable,
|
|
38
137
|
Queue: _Queue.Queue,
|
|
138
|
+
Stackable: _Stackable.Stackable,
|
|
39
139
|
Stack: _Stack.Stack,
|
|
40
140
|
recipes: _recipes.recipes,
|
|
41
141
|
services: _services.services
|
package/dist/main.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/stable");var _Arrayable=require("./collections/arrayable/Arrayable"),_DoublyLinkedList=require("./collections/doubly-linked-list/DoublyLinkedList"),_LinkedList=require("./collections/linked-list/LinkedList"),_LinkedTreeList=require("./collections/linked-tree-list/LinkedTreeList"),_Queue=require("./collections/queue/Queue"),_Stack=require("./collections/stack/Stack"),_recipes=require("./recipes/recipes"),_services=require("./services/services");const collectYourStuff={Arrayable:_Arrayable.Arrayable,DoublyLinkedList:_DoublyLinkedList.DoublyLinkedList,LinkedList:_LinkedList.LinkedList,LinkedTreeList:_LinkedTreeList.LinkedTreeList,Queue:_Queue.Queue,Stack:_Stack.Stack,recipes:_recipes.recipes,services:_services.services};var _default=exports.default=collectYourStuff;"undefined"!=typeof window&&(window.collectYourStuff=collectYourStuff);
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ArrayElement",{enumerable:!0,get:function(){return _ArrayElement.ArrayElement}}),Object.defineProperty(exports,"Arrayable",{enumerable:!0,get:function(){return _Arrayable.Arrayable}}),Object.defineProperty(exports,"DoubleLinker",{enumerable:!0,get:function(){return _DoubleLinker.DoubleLinker}}),Object.defineProperty(exports,"DoublyLinkedList",{enumerable:!0,get:function(){return _DoublyLinkedList.DoublyLinkedList}}),Object.defineProperty(exports,"LinkedList",{enumerable:!0,get:function(){return _LinkedList.LinkedList}}),Object.defineProperty(exports,"LinkedTreeList",{enumerable:!0,get:function(){return _LinkedTreeList.LinkedTreeList}}),Object.defineProperty(exports,"Linker",{enumerable:!0,get:function(){return _Linker.Linker}}),Object.defineProperty(exports,"Queue",{enumerable:!0,get:function(){return _Queue.Queue}}),Object.defineProperty(exports,"Queueable",{enumerable:!0,get:function(){return _Queueable.Queueable}}),Object.defineProperty(exports,"Stack",{enumerable:!0,get:function(){return _Stack.Stack}}),Object.defineProperty(exports,"Stackable",{enumerable:!0,get:function(){return _Stackable.Stackable}}),Object.defineProperty(exports,"TreeLinker",{enumerable:!0,get:function(){return _TreeLinker.TreeLinker}}),exports.default=void 0,Object.defineProperty(exports,"recipes",{enumerable:!0,get:function(){return _recipes.recipes}}),Object.defineProperty(exports,"services",{enumerable:!0,get:function(){return _services.services}}),require("core-js/stable");var _ArrayElement=require("./collections/arrayable/ArrayElement"),_Arrayable=require("./collections/arrayable/Arrayable"),_DoubleLinker=require("./collections/doubly-linked-list/DoubleLinker"),_DoublyLinkedList=require("./collections/doubly-linked-list/DoublyLinkedList"),_Linker=require("./collections/linked-list/Linker"),_LinkedList=require("./collections/linked-list/LinkedList"),_TreeLinker=require("./collections/linked-tree-list/TreeLinker"),_LinkedTreeList=require("./collections/linked-tree-list/LinkedTreeList"),_Queueable=require("./collections/queue/Queueable"),_Queue=require("./collections/queue/Queue"),_Stackable=require("./collections/stack/Stackable"),_Stack=require("./collections/stack/Stack"),_recipes=require("./recipes/recipes"),_services=require("./services/services");const collectYourStuff={ArrayElement:_ArrayElement.ArrayElement,Arrayable:_Arrayable.Arrayable,DoubleLinker:_DoubleLinker.DoubleLinker,DoublyLinkedList:_DoublyLinkedList.DoublyLinkedList,Linker:_Linker.Linker,LinkedList:_LinkedList.LinkedList,TreeLinker:_TreeLinker.TreeLinker,LinkedTreeList:_LinkedTreeList.LinkedTreeList,Queueable:_Queueable.Queueable,Queue:_Queue.Queue,Stackable:_Stackable.Stackable,Stack:_Stack.Stack,recipes:_recipes.recipes,services:_services.services};var _default=exports.default=collectYourStuff;"undefined"!=typeof window&&(window.collectYourStuff=collectYourStuff);
|
|
@@ -5,6 +5,16 @@ import { IsElement } from './IsElement';
|
|
|
5
5
|
export declare class ArrayIterator implements Iterator<IsElement> {
|
|
6
6
|
private readonly innerList;
|
|
7
7
|
private index;
|
|
8
|
+
/**
|
|
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.
|
|
12
|
+
*/
|
|
8
13
|
constructor(innerList: Array<IsElement>, index?: number);
|
|
14
|
+
/**
|
|
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.
|
|
18
|
+
*/
|
|
9
19
|
next(value?: any): IteratorResult<IsElement>;
|
|
10
20
|
}
|
|
@@ -8,11 +8,21 @@ exports.ArrayIterator = void 0
|
|
|
8
8
|
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
9
9
|
*/
|
|
10
10
|
class ArrayIterator {
|
|
11
|
+
/**
|
|
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.
|
|
15
|
+
*/
|
|
11
16
|
constructor (innerList, index = 0) {
|
|
12
17
|
this.innerList = innerList
|
|
13
18
|
this.index = index
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
/**
|
|
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.
|
|
25
|
+
*/
|
|
16
26
|
next (value) {
|
|
17
27
|
if (this.index < this.innerList.length) {
|
|
18
28
|
return {
|
|
@@ -4,6 +4,15 @@ import { IsDoubleLinker } from './IsDoubleLinker';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class DoubleLinkerIterator implements Iterator<IsDoubleLinker> {
|
|
6
6
|
private current;
|
|
7
|
+
/**
|
|
8
|
+
* Create an iterator starting at the given item.
|
|
9
|
+
* @param {IsDoubleLinker} current The item to start from.
|
|
10
|
+
*/
|
|
7
11
|
constructor(current: IsDoubleLinker);
|
|
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
|
+
* @return {IteratorResult<IsDoubleLinker>} The current item, or done when there are no more.
|
|
16
|
+
*/
|
|
8
17
|
next(value?: any): IteratorResult<IsDoubleLinker>;
|
|
9
18
|
}
|
|
@@ -8,10 +8,19 @@ exports.DoubleLinkerIterator = void 0
|
|
|
8
8
|
* Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
9
|
*/
|
|
10
10
|
class DoubleLinkerIterator {
|
|
11
|
+
/**
|
|
12
|
+
* Create an iterator starting at the given item.
|
|
13
|
+
* @param {IsDoubleLinker} current The item to start from.
|
|
14
|
+
*/
|
|
11
15
|
constructor (current) {
|
|
12
16
|
this.current = current
|
|
13
17
|
}
|
|
14
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
|
+
* @return {IteratorResult<IsDoubleLinker>} The current item, or done when there are no more.
|
|
23
|
+
*/
|
|
15
24
|
next (value) {
|
|
16
25
|
const result = {
|
|
17
26
|
value: this.current,
|
|
@@ -4,6 +4,15 @@ import { IsLinker } from './IsLinker';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class LinkerIterator implements Iterator<IsLinker> {
|
|
6
6
|
private current;
|
|
7
|
+
/**
|
|
8
|
+
* Create an iterator starting at the given item.
|
|
9
|
+
* @param {IsLinker} current The item to start from.
|
|
10
|
+
*/
|
|
7
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
|
+
* @return {IteratorResult<IsLinker>} The current item, or done when there are no more.
|
|
16
|
+
*/
|
|
8
17
|
next(value?: any): IteratorResult<IsLinker>;
|
|
9
18
|
}
|
|
@@ -8,10 +8,19 @@ exports.LinkerIterator = void 0
|
|
|
8
8
|
* Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
9
|
*/
|
|
10
10
|
class LinkerIterator {
|
|
11
|
+
/**
|
|
12
|
+
* Create an iterator starting at the given item.
|
|
13
|
+
* @param {IsLinker} current The item to start from.
|
|
14
|
+
*/
|
|
11
15
|
constructor (current) {
|
|
12
16
|
this.current = current
|
|
13
17
|
}
|
|
14
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
|
+
* @return {IteratorResult<IsLinker>} The current item, or done when there are no more.
|
|
23
|
+
*/
|
|
15
24
|
next (value) {
|
|
16
25
|
const result = {
|
|
17
26
|
value: this.current,
|
|
@@ -28,10 +28,11 @@ export interface IsRunnable {
|
|
|
28
28
|
* Identify a class that can be run.
|
|
29
29
|
*/
|
|
30
30
|
export declare class Runnable implements IsRunnable {
|
|
31
|
+
/** The task (or data) this runnable holds. */
|
|
31
32
|
data: any;
|
|
32
33
|
/**
|
|
33
34
|
* Instantiate a Runnable class.
|
|
34
|
-
* @param {*} data
|
|
35
|
+
* @param {*} [data=null] The task (a function) or the data which the task returns.
|
|
35
36
|
*/
|
|
36
37
|
constructor(data?: any);
|
|
37
38
|
/**
|
|
@@ -47,7 +48,7 @@ export declare class Runnable implements IsRunnable {
|
|
|
47
48
|
/**
|
|
48
49
|
* Check if a given thing is Runnable
|
|
49
50
|
* @memberof Runnable
|
|
50
|
-
* @param {*} thing
|
|
51
|
+
* @param {*} thing The value to check, or nothing to check whether this class is Runnable.
|
|
51
52
|
* @return {boolean}
|
|
52
53
|
*/
|
|
53
54
|
static isRunnable(thing: any): boolean;
|
package/dist/recipes/Runnable.js
CHANGED
|
@@ -16,9 +16,10 @@ exports.Runnable = void 0
|
|
|
16
16
|
class Runnable {
|
|
17
17
|
/**
|
|
18
18
|
* Instantiate a Runnable class.
|
|
19
|
-
* @param {*} data
|
|
19
|
+
* @param {*} [data=null] The task (a function) or the data which the task returns.
|
|
20
20
|
*/
|
|
21
21
|
constructor (data = null) {
|
|
22
|
+
/** The task (or data) this runnable holds. */
|
|
22
23
|
this.data = null
|
|
23
24
|
this.data = data
|
|
24
25
|
}
|
|
@@ -45,7 +46,7 @@ class Runnable {
|
|
|
45
46
|
/**
|
|
46
47
|
* Check if a given thing is Runnable
|
|
47
48
|
* @memberof Runnable
|
|
48
|
-
* @param {*} thing
|
|
49
|
+
* @param {*} thing The value to check, or nothing to check whether this class is Runnable.
|
|
49
50
|
* @return {boolean}
|
|
50
51
|
*/
|
|
51
52
|
static isRunnable (thing) {
|
|
@@ -4,6 +4,15 @@ import { IsTreeNode } from './IsTreeNode';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class TreeLinkerIterator implements Iterator<IsTreeNode> {
|
|
6
6
|
private current;
|
|
7
|
+
/**
|
|
8
|
+
* Create an iterator starting at the given item.
|
|
9
|
+
* @param {IsTreeNode} current The item to start from.
|
|
10
|
+
*/
|
|
7
11
|
constructor(current: IsTreeNode);
|
|
12
|
+
/**
|
|
13
|
+
* Get the current item and move on to the following one (left-first, down each branch).
|
|
14
|
+
* @param {*} [value] Not used, present to match the Iterator interface.
|
|
15
|
+
* @return {IteratorResult<IsTreeNode>} The current item, or done when there are no more.
|
|
16
|
+
*/
|
|
8
17
|
next(value?: any): IteratorResult<IsTreeNode>;
|
|
9
18
|
}
|
|
@@ -9,10 +9,19 @@ var _parseTreeNext = require('../services/parseTreeNext')
|
|
|
9
9
|
* Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
|
|
10
10
|
*/
|
|
11
11
|
class TreeLinkerIterator {
|
|
12
|
+
/**
|
|
13
|
+
* Create an iterator starting at the given item.
|
|
14
|
+
* @param {IsTreeNode} current The item to start from.
|
|
15
|
+
*/
|
|
12
16
|
constructor (current) {
|
|
13
17
|
this.current = current
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Get the current item and move on to the following one (left-first, down each branch).
|
|
22
|
+
* @param {*} [value] Not used, present to match the Iterator interface.
|
|
23
|
+
* @return {IteratorResult<IsTreeNode>} The current item, or done when there are no more.
|
|
24
|
+
*/
|
|
16
25
|
next (value) {
|
|
17
26
|
const result = {
|
|
18
27
|
value: this.current,
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
* List helpful functions when dealing with collections.
|
|
9
9
|
*/
|
|
10
10
|
export declare const services: {
|
|
11
|
-
parseTree: (tree: import("../
|
|
12
|
-
parseTreeNext: (treeNode: import("../
|
|
11
|
+
parseTree: (tree: import("../main").IsTree, callback: import("../main").forEachCallback) => import("../main").IsTree;
|
|
12
|
+
parseTreeNext: (treeNode: import("../main").IsTreeNode) => import("../main").IsTreeNode | null;
|
|
13
13
|
};
|
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": "1.2
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
7
7
|
"author": "Joshua Heagle",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"htmldocs": "jsdoc -R MAIN.md -c ./.jsdoc.conf.js -d docs",
|
|
20
20
|
"readme": "gulp readme",
|
|
21
21
|
"test": "gulp testFull",
|
|
22
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
22
23
|
"test:quick": "gulp testQuick",
|
|
23
24
|
"watch": "gulp watchFull",
|
|
24
25
|
"watch:test": "gulp watchTest"
|