collect-your-stuff 2.1.1 → 2.1.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 +898 -213
- package/browser/collect-your-stuff.js +677 -648
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +38 -38
- package/dist/collections/arrayable/ArrayElement.js +66 -66
- package/dist/collections/arrayable/Arrayable.d.ts +122 -122
- package/dist/collections/arrayable/Arrayable.js +2 -2
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +50 -50
- package/dist/collections/doubly-linked-list/DoubleLinker.js +1 -1
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +125 -125
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +3 -3
- package/dist/collections/linked-list/LinkedList.d.ts +126 -126
- package/dist/collections/linked-list/LinkedList.js +3 -3
- package/dist/collections/linked-list/Linker.d.ts +46 -46
- package/dist/collections/linked-list/Linker.js +1 -1
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +159 -159
- package/dist/collections/linked-tree-list/LinkedTreeList.js +3 -3
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +71 -71
- package/dist/collections/linked-tree-list/TreeLinker.js +2 -2
- package/dist/collections/queue/Queue.d.ts +59 -59
- package/dist/collections/queue/Queue.js +11 -9
- package/dist/collections/queue/Queueable.d.ts +83 -83
- package/dist/collections/queue/Queueable.js +9 -7
- package/dist/collections/queue/TaskQueue.d.ts +68 -68
- package/dist/collections/queue/TaskQueue.js +2 -2
- package/dist/collections/stack/Stack.d.ts +64 -64
- package/dist/collections/stack/Stack.js +11 -9
- package/dist/collections/stack/Stackable.d.ts +59 -59
- package/dist/collections/stack/Stackable.js +1 -1
- package/dist/collections/stack/TaskStack.d.ts +65 -65
- package/dist/collections/stack/TaskStack.js +2 -2
- package/dist/main.d.ts +68 -68
- package/dist/main.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 +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/IsQueue.d.ts +37 -37
- package/dist/recipes/IsQueue.js +5 -5
- package/dist/recipes/IsStack.d.ts +36 -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 +55 -55
- package/dist/recipes/Runnable.js +69 -69
- package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
- package/dist/recipes/TreeLinkerIterator.js +1 -1
- package/dist/recipes/recipes.d.ts +15 -15
- package/dist/recipes/recipes.js +2 -2
- package/dist/services/parseTree.d.ts +9 -9
- package/dist/services/parseTree.js +1 -1
- package/dist/services/parseTreeNext.d.ts +17 -17
- package/dist/services/parseTreeNext.js +42 -42
- package/dist/services/services.d.ts +13 -13
- package/dist/services/services.js +2 -2
- package/package.json +2 -2
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file task stack.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
5
|
-
* @memberOf module:collect-your-stuff
|
|
6
|
-
*/
|
|
7
|
-
import { Stackable } from './Stackable';
|
|
8
|
-
import { IsArrayable } from '../../recipes/IsArrayable';
|
|
9
|
-
import { IsLinker } from '../../recipes/IsLinker';
|
|
10
|
-
import { completeResponse } from '../../recipes/Runnable';
|
|
11
|
-
/**
|
|
12
|
-
* Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
|
|
13
|
-
* the top and RUNS it. For a plain last-in-first-out collection of items use Stack.
|
|
14
|
-
*/
|
|
15
|
-
export declare class TaskStack {
|
|
16
|
-
/** The list which stores the stackables, the first is the top of the stack. */
|
|
17
|
-
stackedList: IsArrayable<any>;
|
|
18
|
-
private listClass;
|
|
19
|
-
private stackableClass;
|
|
20
|
-
/**
|
|
21
|
-
* Instantiate the state with the starter stacked list.
|
|
22
|
-
* @param {Iterable|LinkedList} [stackedList=null] The list of stackables to start in this stack.
|
|
23
|
-
* @param {IsArrayable} [listClass=LinkedList] The type of list to create when no stacked list is given.
|
|
24
|
-
* @param {Stackable} [stackableClass=Stackable] The class used to wrap stacked items.
|
|
25
|
-
*/
|
|
26
|
-
constructor(stackedList?: IsArrayable<any>, listClass?: any, stackableClass?: typeof Stackable);
|
|
27
|
-
/**
|
|
28
|
-
* Return true if the stack is empty (there are no tasks in the stacked list)
|
|
29
|
-
* @return {boolean}
|
|
30
|
-
*/
|
|
31
|
-
empty(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Take a look at the next stacked task
|
|
34
|
-
* @return {Stackable}
|
|
35
|
-
*/
|
|
36
|
-
top(): IsLinker;
|
|
37
|
-
/**
|
|
38
|
-
* Remove the next stacked task and return it.
|
|
39
|
-
* @return {Stackable|null}
|
|
40
|
-
*/
|
|
41
|
-
pop(): Stackable | completeResponse | null;
|
|
42
|
-
/**
|
|
43
|
-
* Push a stackable task to the top of the stack.
|
|
44
|
-
* @param {Stackable|*} stackable Add a new stackable to the top of the stack
|
|
45
|
-
*/
|
|
46
|
-
push(stackable: any): void;
|
|
47
|
-
/**
|
|
48
|
-
* Remove the next stacked task and return it.
|
|
49
|
-
* @return {Stackable|null}
|
|
50
|
-
*/
|
|
51
|
-
remove(): Stackable | null;
|
|
52
|
-
/**
|
|
53
|
-
* Get the size of the current stack.
|
|
54
|
-
* @return {number}
|
|
55
|
-
*/
|
|
56
|
-
size(): number;
|
|
57
|
-
/**
|
|
58
|
-
* Convert an array to a TaskStack.
|
|
59
|
-
* @param {Array} values An array of values which will be converted to stackables in this queue
|
|
60
|
-
* @param {Stackable} stackableClass The class to use for each stackable
|
|
61
|
-
* @param {TaskStack|Iterable} listClass The class to use to manage the stackables
|
|
62
|
-
* @returns {TaskStack}
|
|
63
|
-
*/
|
|
64
|
-
static fromArray: (values?: Array<any>, stackableClass?: typeof Stackable, listClass?: any) => TaskStack;
|
|
65
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file task stack.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
* @memberOf module:collect-your-stuff
|
|
6
|
+
*/
|
|
7
|
+
import { Stackable } from './Stackable';
|
|
8
|
+
import { IsArrayable } from '../../recipes/IsArrayable';
|
|
9
|
+
import { IsLinker } from '../../recipes/IsLinker';
|
|
10
|
+
import { completeResponse } from '../../recipes/Runnable';
|
|
11
|
+
/**
|
|
12
|
+
* Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
|
|
13
|
+
* the top and RUNS it. For a plain last-in-first-out collection of items use Stack.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TaskStack {
|
|
16
|
+
/** The list which stores the stackables, the first is the top of the stack. */
|
|
17
|
+
stackedList: IsArrayable<any>;
|
|
18
|
+
private listClass;
|
|
19
|
+
private stackableClass;
|
|
20
|
+
/**
|
|
21
|
+
* Instantiate the state with the starter stacked list.
|
|
22
|
+
* @param {Iterable|LinkedList} [stackedList=null] The list of stackables to start in this stack.
|
|
23
|
+
* @param {IsArrayable} [listClass=LinkedList] The type of list to create when no stacked list is given.
|
|
24
|
+
* @param {Stackable} [stackableClass=Stackable] The class used to wrap stacked items.
|
|
25
|
+
*/
|
|
26
|
+
constructor(stackedList?: IsArrayable<any>, listClass?: any, stackableClass?: typeof Stackable);
|
|
27
|
+
/**
|
|
28
|
+
* Return true if the stack is empty (there are no tasks in the stacked list)
|
|
29
|
+
* @return {boolean}
|
|
30
|
+
*/
|
|
31
|
+
empty(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Take a look at the next stacked task
|
|
34
|
+
* @return {Stackable}
|
|
35
|
+
*/
|
|
36
|
+
top(): IsLinker;
|
|
37
|
+
/**
|
|
38
|
+
* Remove the next stacked task and return it.
|
|
39
|
+
* @return {Stackable|null}
|
|
40
|
+
*/
|
|
41
|
+
pop(): Stackable | completeResponse | null;
|
|
42
|
+
/**
|
|
43
|
+
* Push a stackable task to the top of the stack.
|
|
44
|
+
* @param {Stackable|*} stackable Add a new stackable to the top of the stack
|
|
45
|
+
*/
|
|
46
|
+
push(stackable: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* Remove the next stacked task and return it.
|
|
49
|
+
* @return {Stackable|null}
|
|
50
|
+
*/
|
|
51
|
+
remove(): Stackable | null;
|
|
52
|
+
/**
|
|
53
|
+
* Get the size of the current stack.
|
|
54
|
+
* @return {number}
|
|
55
|
+
*/
|
|
56
|
+
size(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Convert an array to a TaskStack.
|
|
59
|
+
* @param {Array} values An array of values which will be converted to stackables in this queue
|
|
60
|
+
* @param {Stackable} stackableClass The class to use for each stackable
|
|
61
|
+
* @param {TaskStack|Iterable} listClass The class to use to manage the stackables
|
|
62
|
+
* @returns {TaskStack}
|
|
63
|
+
*/
|
|
64
|
+
static fromArray: (values?: Array<any>, stackableClass?: typeof Stackable, listClass?: any) => TaskStack;
|
|
65
|
+
}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
4
4
|
value: true
|
|
5
5
|
})
|
|
6
6
|
exports.TaskStack = void 0
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const _Stackable = require('./Stackable')
|
|
8
|
+
const _LinkedList = require('../linked-list/LinkedList')
|
|
9
9
|
/**
|
|
10
10
|
* @file task stack.
|
|
11
11
|
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
package/dist/main.d.ts
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All of the collections available.
|
|
3
|
-
* @file
|
|
4
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
-
* @version 1.0.0
|
|
6
|
-
* @module collect-your-stuff
|
|
7
|
-
*/
|
|
8
|
-
import { ArrayElement } from './collections/arrayable/ArrayElement';
|
|
9
|
-
import { Arrayable } from './collections/arrayable/Arrayable';
|
|
10
|
-
import { DoubleLinker } from './collections/doubly-linked-list/DoubleLinker';
|
|
11
|
-
import { DoublyLinkedList } from './collections/doubly-linked-list/DoublyLinkedList';
|
|
12
|
-
import { Linker } from './collections/linked-list/Linker';
|
|
13
|
-
import { LinkedList } from './collections/linked-list/LinkedList';
|
|
14
|
-
import { TreeLinker } from './collections/linked-tree-list/TreeLinker';
|
|
15
|
-
import { LinkedTreeList } from './collections/linked-tree-list/LinkedTreeList';
|
|
16
|
-
import { Queueable } from './collections/queue/Queueable';
|
|
17
|
-
import { Queue } from './collections/queue/Queue';
|
|
18
|
-
import { TaskQueue } from './collections/queue/TaskQueue';
|
|
19
|
-
import { Stackable } from './collections/stack/Stackable';
|
|
20
|
-
import { Stack } from './collections/stack/Stack';
|
|
21
|
-
import { TaskStack } from './collections/stack/TaskStack';
|
|
22
|
-
import { recipes } from './recipes/recipes';
|
|
23
|
-
import { services } from './services/services';
|
|
24
|
-
/**
|
|
25
|
-
* TODO:
|
|
26
|
-
* 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
|
|
27
|
-
* 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
|
-
* 3. Create a graph type which can have directional and undirectional variants for linking nodes
|
|
29
|
-
*/
|
|
30
|
-
export { ArrayElement, Arrayable, DoubleLinker, DoublyLinkedList, Linker, LinkedList, TreeLinker, LinkedTreeList, Queueable, Queue, TaskQueue, Stackable, Stack, TaskStack, recipes, services };
|
|
31
|
-
export type { IsArrayable, forEachCallback } from './recipes/IsArrayable';
|
|
32
|
-
export type { IsDoubleLinker } from './recipes/IsDoubleLinker';
|
|
33
|
-
export type { IsElement } from './recipes/IsElement';
|
|
34
|
-
export type { IsLinker } from './recipes/IsLinker';
|
|
35
|
-
export type { IsTree } from './recipes/IsTree';
|
|
36
|
-
export type { IsTreeNode } from './recipes/IsTreeNode';
|
|
37
|
-
export type { IsQueue } from './recipes/IsQueue';
|
|
38
|
-
export type { IsStack } from './recipes/IsStack';
|
|
39
|
-
export type { IsRunnable, completeResponse } from './recipes/Runnable';
|
|
40
|
-
/**
|
|
41
|
-
* All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
|
|
42
|
-
* set of classes as the named exports).
|
|
43
|
-
*/
|
|
44
|
-
declare const collectYourStuff: {
|
|
45
|
-
ArrayElement: typeof ArrayElement;
|
|
46
|
-
Arrayable: typeof Arrayable;
|
|
47
|
-
DoubleLinker: typeof DoubleLinker;
|
|
48
|
-
DoublyLinkedList: typeof DoublyLinkedList;
|
|
49
|
-
Linker: typeof Linker;
|
|
50
|
-
LinkedList: typeof LinkedList;
|
|
51
|
-
TreeLinker: typeof TreeLinker;
|
|
52
|
-
LinkedTreeList: typeof LinkedTreeList;
|
|
53
|
-
Queueable: typeof Queueable;
|
|
54
|
-
Queue: typeof Queue;
|
|
55
|
-
TaskQueue: typeof TaskQueue;
|
|
56
|
-
Stackable: typeof Stackable;
|
|
57
|
-
Stack: typeof Stack;
|
|
58
|
-
TaskStack: typeof TaskStack;
|
|
59
|
-
recipes: {
|
|
60
|
-
ArrayIterator: typeof import("./recipes/ArrayIterator").ArrayIterator;
|
|
61
|
-
Runnable: typeof import("./recipes/Runnable").Runnable;
|
|
62
|
-
};
|
|
63
|
-
services: {
|
|
64
|
-
parseTree: (tree: import("./main").IsTree, callback: import("./main").forEachCallback) => import("./main").IsTree;
|
|
65
|
-
parseTreeNext: (treeNode: import("./main").IsTreeNode, boundaryParent?: import("./main").IsTreeNode | null) => import("./main").IsTreeNode | null;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
export default collectYourStuff;
|
|
1
|
+
/**
|
|
2
|
+
* All of the collections available.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @module collect-your-stuff
|
|
7
|
+
*/
|
|
8
|
+
import { ArrayElement } from './collections/arrayable/ArrayElement';
|
|
9
|
+
import { Arrayable } from './collections/arrayable/Arrayable';
|
|
10
|
+
import { DoubleLinker } from './collections/doubly-linked-list/DoubleLinker';
|
|
11
|
+
import { DoublyLinkedList } from './collections/doubly-linked-list/DoublyLinkedList';
|
|
12
|
+
import { Linker } from './collections/linked-list/Linker';
|
|
13
|
+
import { LinkedList } from './collections/linked-list/LinkedList';
|
|
14
|
+
import { TreeLinker } from './collections/linked-tree-list/TreeLinker';
|
|
15
|
+
import { LinkedTreeList } from './collections/linked-tree-list/LinkedTreeList';
|
|
16
|
+
import { Queueable } from './collections/queue/Queueable';
|
|
17
|
+
import { Queue } from './collections/queue/Queue';
|
|
18
|
+
import { TaskQueue } from './collections/queue/TaskQueue';
|
|
19
|
+
import { Stackable } from './collections/stack/Stackable';
|
|
20
|
+
import { Stack } from './collections/stack/Stack';
|
|
21
|
+
import { TaskStack } from './collections/stack/TaskStack';
|
|
22
|
+
import { recipes } from './recipes/recipes';
|
|
23
|
+
import { services } from './services/services';
|
|
24
|
+
/**
|
|
25
|
+
* TODO:
|
|
26
|
+
* 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
|
|
27
|
+
* 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
|
+
* 3. Create a graph type which can have directional and undirectional variants for linking nodes
|
|
29
|
+
*/
|
|
30
|
+
export { ArrayElement, Arrayable, DoubleLinker, DoublyLinkedList, Linker, LinkedList, TreeLinker, LinkedTreeList, Queueable, Queue, TaskQueue, Stackable, Stack, TaskStack, recipes, services };
|
|
31
|
+
export type { IsArrayable, forEachCallback } from './recipes/IsArrayable';
|
|
32
|
+
export type { IsDoubleLinker } from './recipes/IsDoubleLinker';
|
|
33
|
+
export type { IsElement } from './recipes/IsElement';
|
|
34
|
+
export type { IsLinker } from './recipes/IsLinker';
|
|
35
|
+
export type { IsTree } from './recipes/IsTree';
|
|
36
|
+
export type { IsTreeNode } from './recipes/IsTreeNode';
|
|
37
|
+
export type { IsQueue } from './recipes/IsQueue';
|
|
38
|
+
export type { IsStack } from './recipes/IsStack';
|
|
39
|
+
export type { IsRunnable, completeResponse } from './recipes/Runnable';
|
|
40
|
+
/**
|
|
41
|
+
* All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
|
|
42
|
+
* set of classes as the named exports).
|
|
43
|
+
*/
|
|
44
|
+
declare const collectYourStuff: {
|
|
45
|
+
ArrayElement: typeof ArrayElement;
|
|
46
|
+
Arrayable: typeof Arrayable;
|
|
47
|
+
DoubleLinker: typeof DoubleLinker;
|
|
48
|
+
DoublyLinkedList: typeof DoublyLinkedList;
|
|
49
|
+
Linker: typeof Linker;
|
|
50
|
+
LinkedList: typeof LinkedList;
|
|
51
|
+
TreeLinker: typeof TreeLinker;
|
|
52
|
+
LinkedTreeList: typeof LinkedTreeList;
|
|
53
|
+
Queueable: typeof Queueable;
|
|
54
|
+
Queue: typeof Queue;
|
|
55
|
+
TaskQueue: typeof TaskQueue;
|
|
56
|
+
Stackable: typeof Stackable;
|
|
57
|
+
Stack: typeof Stack;
|
|
58
|
+
TaskStack: typeof TaskStack;
|
|
59
|
+
recipes: {
|
|
60
|
+
ArrayIterator: typeof import("./recipes/ArrayIterator").ArrayIterator;
|
|
61
|
+
Runnable: typeof import("./recipes/Runnable").Runnable;
|
|
62
|
+
};
|
|
63
|
+
services: {
|
|
64
|
+
parseTree: (tree: import("./main").IsTree, callback: import("./main").forEachCallback) => import("./main").IsTree;
|
|
65
|
+
parseTreeNext: (treeNode: import("./main").IsTreeNode, boundaryParent?: import("./main").IsTreeNode | null) => import("./main").IsTreeNode | null;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export default collectYourStuff;
|
package/dist/main.js
CHANGED
|
@@ -155,7 +155,7 @@ const collectYourStuff = {
|
|
|
155
155
|
recipes: _recipes.recipes,
|
|
156
156
|
services: _services.services
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
const _default = exports.default = collectYourStuff
|
|
159
159
|
if (void 0) {
|
|
160
160
|
// @ts-ignore
|
|
161
161
|
(void 0).collectYourStuff = collectYourStuff
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { IsElement } from './IsElement';
|
|
2
|
-
/**
|
|
3
|
-
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ArrayIterator implements Iterator<IsElement> {
|
|
6
|
-
private readonly innerList;
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
19
|
-
next(value?: any): IteratorResult<IsElement>;
|
|
20
|
-
}
|
|
1
|
+
import { IsElement } from './IsElement';
|
|
2
|
+
/**
|
|
3
|
+
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ArrayIterator implements Iterator<IsElement> {
|
|
6
|
+
private readonly innerList;
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
19
|
+
next(value?: any): IteratorResult<IsElement>;
|
|
20
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.ArrayIterator = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
9
|
-
*/
|
|
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
|
-
*/
|
|
16
|
-
constructor (innerList, index = 0) {
|
|
17
|
-
this.innerList = innerList
|
|
18
|
-
this.index = index
|
|
19
|
-
}
|
|
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
|
-
*/
|
|
26
|
-
next (value) {
|
|
27
|
-
if (this.index < this.innerList.length) {
|
|
28
|
-
return {
|
|
29
|
-
value: this.innerList[this.index++],
|
|
30
|
-
done: false
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
value: undefined,
|
|
35
|
-
done: true
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ArrayIterator = ArrayIterator
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.ArrayIterator = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
9
|
+
*/
|
|
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
|
+
*/
|
|
16
|
+
constructor (innerList, index = 0) {
|
|
17
|
+
this.innerList = innerList
|
|
18
|
+
this.index = index
|
|
19
|
+
}
|
|
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
|
+
*/
|
|
26
|
+
next (value) {
|
|
27
|
+
if (this.index < this.innerList.length) {
|
|
28
|
+
return {
|
|
29
|
+
value: this.innerList[this.index++],
|
|
30
|
+
done: false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
value: undefined,
|
|
35
|
+
done: true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ArrayIterator = ArrayIterator
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { IsDoubleLinker } from './IsDoubleLinker';
|
|
2
|
-
/**
|
|
3
|
-
* Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
4
|
-
*/
|
|
5
|
-
export declare class DoubleLinkerIterator implements Iterator<IsDoubleLinker> {
|
|
6
|
-
private current;
|
|
7
|
-
/**
|
|
8
|
-
* Create an iterator starting at the given item.
|
|
9
|
-
* @param {IsDoubleLinker} current The item to start from.
|
|
10
|
-
*/
|
|
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
|
-
*/
|
|
17
|
-
next(value?: any): IteratorResult<IsDoubleLinker>;
|
|
18
|
-
}
|
|
1
|
+
import { IsDoubleLinker } from './IsDoubleLinker';
|
|
2
|
+
/**
|
|
3
|
+
* Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
4
|
+
*/
|
|
5
|
+
export declare class DoubleLinkerIterator implements Iterator<IsDoubleLinker> {
|
|
6
|
+
private current;
|
|
7
|
+
/**
|
|
8
|
+
* Create an iterator starting at the given item.
|
|
9
|
+
* @param {IsDoubleLinker} current The item to start from.
|
|
10
|
+
*/
|
|
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
|
+
*/
|
|
17
|
+
next(value?: any): IteratorResult<IsDoubleLinker>;
|
|
18
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.DoubleLinkerIterator = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
|
-
*/
|
|
10
|
-
class DoubleLinkerIterator {
|
|
11
|
-
/**
|
|
12
|
-
* Create an iterator starting at the given item.
|
|
13
|
-
* @param {IsDoubleLinker} 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
|
-
* @return {IteratorResult<IsDoubleLinker>} 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.DoubleLinkerIterator = DoubleLinkerIterator
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.DoubleLinkerIterator = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
9
|
+
*/
|
|
10
|
+
class DoubleLinkerIterator {
|
|
11
|
+
/**
|
|
12
|
+
* Create an iterator starting at the given item.
|
|
13
|
+
* @param {IsDoubleLinker} 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
|
+
* @return {IteratorResult<IsDoubleLinker>} 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.DoubleLinkerIterator = DoubleLinkerIterator
|