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.
- package/README.md +32 -3241
- package/browser/collect-your-stuff.js +1585 -1193
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
- package/dist/collections/arrayable/ArrayElement.js +64 -66
- package/dist/collections/arrayable/Arrayable.d.ts +107 -122
- package/dist/collections/arrayable/Arrayable.js +208 -223
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
- package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
- package/dist/collections/linked-list/LinkedList.d.ts +110 -126
- package/dist/collections/linked-list/LinkedList.js +283 -296
- package/dist/collections/linked-list/Linker.d.ts +41 -46
- package/dist/collections/linked-list/Linker.js +82 -84
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
- package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
- package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
- package/dist/collections/queue/Queue.d.ts +55 -59
- package/dist/collections/queue/Queue.js +114 -119
- package/dist/collections/queue/Queueable.d.ts +74 -83
- package/dist/collections/queue/Queueable.js +142 -146
- package/dist/collections/queue/TaskQueue.d.ts +59 -68
- package/dist/collections/queue/TaskQueue.js +128 -137
- package/dist/collections/scoped-collection/ScopedCollection.d.ts +42 -0
- package/dist/collections/scoped-collection/ScopedCollection.js +81 -0
- package/dist/collections/scoped-collection/ScopedCollection.min.js +1 -0
- package/dist/collections/stack/Stack.d.ts +60 -64
- package/dist/collections/stack/Stack.js +122 -127
- package/dist/collections/stack/Stackable.d.ts +52 -59
- package/dist/collections/stack/Stackable.js +81 -85
- package/dist/collections/stack/TaskStack.d.ts +56 -65
- package/dist/collections/stack/TaskStack.js +98 -107
- package/dist/main.d.ts +4 -5
- package/dist/main.js +9 -5
- package/dist/main.min.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 +85 -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 +32 -37
- package/dist/recipes/IsQueue.js +5 -5
- package/dist/recipes/IsScopedCollection.d.ts +27 -0
- package/dist/recipes/IsScopedCollection.js +5 -0
- package/dist/recipes/IsScopedCollection.min.js +1 -0
- package/dist/recipes/IsStack.d.ts +31 -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 +42 -55
- package/dist/recipes/Runnable.js +63 -69
- package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
- package/dist/recipes/TreeLinkerIterator.js +36 -36
- package/dist/recipes/recipes.d.ts +12 -15
- package/dist/recipes/recipes.js +19 -22
- package/dist/services/parseTree.d.ts +8 -9
- package/dist/services/parseTree.js +23 -24
- package/dist/services/parseTreeNext.d.ts +16 -17
- package/dist/services/parseTreeNext.js +41 -42
- package/dist/services/services.d.ts +10 -13
- package/dist/services/services.js +19 -22
- package/package.json +4 -4
|
@@ -1,71 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*/
|
|
67
|
-
static fromArray: (values?: Array<any>, classType?: any) => {
|
|
68
|
-
head: TreeLinker | any;
|
|
69
|
-
tail: TreeLinker | any;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* doubly linked tree node.
|
|
3
|
+
*/
|
|
4
|
+
import { IsArrayable } from '../../recipes/IsArrayable';
|
|
5
|
+
import { IsTreeNode } from '../../recipes/IsTreeNode';
|
|
6
|
+
import { IsTree } from '../../recipes/IsTree';
|
|
7
|
+
/**
|
|
8
|
+
* TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
|
|
9
|
+
* @extends DoubleLinker
|
|
10
|
+
*/
|
|
11
|
+
export declare class TreeLinker implements IsTreeNode {
|
|
12
|
+
/** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
|
|
13
|
+
readonly classType: typeof TreeLinker;
|
|
14
|
+
/** The data stored in this tree node. */
|
|
15
|
+
data: any;
|
|
16
|
+
/** The sibling after this node, or null when this is the last child. */
|
|
17
|
+
next: IsTreeNode | null;
|
|
18
|
+
/** The sibling before this node, or null when this is the first child. */
|
|
19
|
+
prev: IsTreeNode | null;
|
|
20
|
+
/** The node this node is a child of, or null for a root node. */
|
|
21
|
+
parent: IsTreeNode;
|
|
22
|
+
/** The list of the children of this node, or null when it has none. */
|
|
23
|
+
children: IsArrayable<IsTreeNode>;
|
|
24
|
+
/**
|
|
25
|
+
* Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
26
|
+
* @param settings The settings for the new tree node.
|
|
27
|
+
* @param settings.data The data to be stored in this tree node
|
|
28
|
+
* @param settings.next The reference to the next linker if any
|
|
29
|
+
* @param settings.prev The reference to the previous linker if any
|
|
30
|
+
* @param settings.children The references to child linkers if any
|
|
31
|
+
* @param settings.parent The reference to a parent linker if any
|
|
32
|
+
* @param listClass Give the type of list to use for storing the children
|
|
33
|
+
*/
|
|
34
|
+
constructor({ data, next, prev, children, parent, listClass }?: {
|
|
35
|
+
data?: any;
|
|
36
|
+
next?: IsTreeNode;
|
|
37
|
+
prev?: IsTreeNode;
|
|
38
|
+
children?: Array<any>;
|
|
39
|
+
parent?: IsTreeNode;
|
|
40
|
+
listClass?: any;
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
|
|
44
|
+
* existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
|
|
45
|
+
* else is the data of the linker.
|
|
46
|
+
* @param children Provide an array of data / linker references to be children of this tree node.
|
|
47
|
+
* @param listClass Give the type of list to use for storing the children
|
|
48
|
+
*/
|
|
49
|
+
childrenFromArray(children?: Array<any> | null, listClass?: any): IsTree | any;
|
|
50
|
+
/**
|
|
51
|
+
* Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
52
|
+
* @param linker Return a valid TreeLinker instance from given data, or even an already valid one.
|
|
53
|
+
* @param classType Provide the type of IsTreeNode to use.
|
|
54
|
+
*/
|
|
55
|
+
static make: (linker: TreeLinker | any, classType?: any) => IsTreeNode | any;
|
|
56
|
+
/**
|
|
57
|
+
* Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
58
|
+
* @param values Provide an array of data that will be converted to a chain of tree-linkers.
|
|
59
|
+
* @param classType Provide the type of IsTreeNode to use.
|
|
60
|
+
*/
|
|
61
|
+
static fromArray: (values?: Array<any>, classType?: any) => {
|
|
62
|
+
head: TreeLinker | any;
|
|
63
|
+
tail: TreeLinker | any;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -1,94 +1,91 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.TreeLinker = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.map.js')
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
|
|
13
|
-
* @extends DoubleLinker
|
|
14
|
-
*/
|
|
15
|
-
class TreeLinker {
|
|
16
|
-
/**
|
|
17
|
-
* Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
*/
|
|
26
|
-
constructor ({
|
|
27
|
-
data = null,
|
|
28
|
-
next = null,
|
|
29
|
-
prev = null,
|
|
30
|
-
children = null,
|
|
31
|
-
parent = null,
|
|
32
|
-
listClass = _LinkedTreeList.LinkedTreeList
|
|
33
|
-
} = {}) {
|
|
34
|
-
/** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
|
|
35
|
-
this.classType = TreeLinker
|
|
36
|
-
/** The data stored in this tree node. */
|
|
37
|
-
this.data = null
|
|
38
|
-
/** The sibling after this node, or null when this is the last child. */
|
|
39
|
-
this.next = null
|
|
40
|
-
/** The sibling before this node, or null when this is the first child. */
|
|
41
|
-
this.prev = null
|
|
42
|
-
/** The node this node is a child of, or null for a root node. */
|
|
43
|
-
this.parent = null
|
|
44
|
-
/** The list of the children of this node, or null when it has none. */
|
|
45
|
-
this.children = null
|
|
46
|
-
this.data = data
|
|
47
|
-
this.next = next
|
|
48
|
-
this.prev = prev
|
|
49
|
-
this.parent = parent
|
|
50
|
-
this.children = this.childrenFromArray(children, listClass)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
|
|
55
|
-
* existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
|
|
56
|
-
* else is the data of the linker.
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
linker
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
list
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* @returns {{head: TreeLinker, tail: TreeLinker}}
|
|
93
|
-
*/
|
|
94
|
-
TreeLinker.fromArray = (values = [], classType = TreeLinker) => _DoubleLinker.DoubleLinker.fromArray(values, classType)
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.TreeLinker = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js')
|
|
9
|
+
const _DoubleLinker = require('../doubly-linked-list/DoubleLinker')
|
|
10
|
+
const _LinkedTreeList = require('./LinkedTreeList')
|
|
11
|
+
/**
|
|
12
|
+
* TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
|
|
13
|
+
* @extends DoubleLinker
|
|
14
|
+
*/
|
|
15
|
+
class TreeLinker {
|
|
16
|
+
/**
|
|
17
|
+
* Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
18
|
+
* @param settings The settings for the new tree node.
|
|
19
|
+
* @param settings.data The data to be stored in this tree node
|
|
20
|
+
* @param settings.next The reference to the next linker if any
|
|
21
|
+
* @param settings.prev The reference to the previous linker if any
|
|
22
|
+
* @param settings.children The references to child linkers if any
|
|
23
|
+
* @param settings.parent The reference to a parent linker if any
|
|
24
|
+
* @param listClass Give the type of list to use for storing the children
|
|
25
|
+
*/
|
|
26
|
+
constructor ({
|
|
27
|
+
data = null,
|
|
28
|
+
next = null,
|
|
29
|
+
prev = null,
|
|
30
|
+
children = null,
|
|
31
|
+
parent = null,
|
|
32
|
+
listClass = _LinkedTreeList.LinkedTreeList
|
|
33
|
+
} = {}) {
|
|
34
|
+
/** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
|
|
35
|
+
this.classType = TreeLinker
|
|
36
|
+
/** The data stored in this tree node. */
|
|
37
|
+
this.data = null
|
|
38
|
+
/** The sibling after this node, or null when this is the last child. */
|
|
39
|
+
this.next = null
|
|
40
|
+
/** The sibling before this node, or null when this is the first child. */
|
|
41
|
+
this.prev = null
|
|
42
|
+
/** The node this node is a child of, or null for a root node. */
|
|
43
|
+
this.parent = null
|
|
44
|
+
/** The list of the children of this node, or null when it has none. */
|
|
45
|
+
this.children = null
|
|
46
|
+
this.data = data
|
|
47
|
+
this.next = next
|
|
48
|
+
this.prev = prev
|
|
49
|
+
this.parent = parent
|
|
50
|
+
this.children = this.childrenFromArray(children, listClass)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
|
|
55
|
+
* existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
|
|
56
|
+
* else is the data of the linker.
|
|
57
|
+
* @param children Provide an array of data / linker references to be children of this tree node.
|
|
58
|
+
* @param listClass Give the type of list to use for storing the children
|
|
59
|
+
*/
|
|
60
|
+
childrenFromArray (children = null, listClass = _LinkedTreeList.LinkedTreeList) {
|
|
61
|
+
if (children === null) {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
// Every child is made into a tree linker (an existing one is kept as it is, and a plain value is the data) and is
|
|
65
|
+
// given this node as its parent
|
|
66
|
+
const nodes = children.map(child => {
|
|
67
|
+
const linker = this.classType.make(child, this.classType)
|
|
68
|
+
linker.parent = this
|
|
69
|
+
return linker
|
|
70
|
+
})
|
|
71
|
+
// Creates a linked-tree-list to store the children, which remembers this node as its parent even when it is empty
|
|
72
|
+
const list = listClass.fromArray(nodes, this.classType)
|
|
73
|
+
list.parent = this
|
|
74
|
+
return list
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
79
|
+
* @param linker Return a valid TreeLinker instance from given data, or even an already valid one.
|
|
80
|
+
* @param classType Provide the type of IsTreeNode to use.
|
|
81
|
+
*/
|
|
82
|
+
exports.TreeLinker = TreeLinker
|
|
83
|
+
TreeLinker.make = (linker, classType = TreeLinker) => {
|
|
84
|
+
return _DoubleLinker.DoubleLinker.make(linker, classType)
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
88
|
+
* @param values Provide an array of data that will be converted to a chain of tree-linkers.
|
|
89
|
+
* @param classType Provide the type of IsTreeNode to use.
|
|
90
|
+
*/
|
|
91
|
+
TreeLinker.fromArray = (values = [], classType = TreeLinker) => _DoubleLinker.DoubleLinker.fromArray(values, classType)
|
|
@@ -1,59 +1,55 @@
|
|
|
1
|
-
import { Linker } from '../linked-list/Linker';
|
|
2
|
-
import { IsArrayable } from '../../recipes/IsArrayable';
|
|
3
|
-
import { IsQueue } from '../../recipes/IsQueue';
|
|
4
|
-
/**
|
|
5
|
-
* A first-in-first-out collection: items are added to the back with enqueue and taken from the front with dequeue.
|
|
6
|
-
* Any value can be queued (it is stored as it is, whether it is a function, an object or null), and adding and taking
|
|
7
|
-
* are constant time. To queue tasks which are run as they are taken use TaskQueue.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Queue<T = any> implements IsQueue<T>, Iterable<T> {
|
|
10
|
-
/** The list which stores the queued items, the first is next to be dequeued. */
|
|
11
|
-
queuedList: IsArrayable<any>;
|
|
12
|
-
private readonly linkerClass;
|
|
13
|
-
/**
|
|
14
|
-
* Instantiate the queue, optionally with a list of items to start from.
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
*/
|
|
19
|
-
constructor(queuedList?: IsArrayable<any> | null, listClass?: any, linkerClass?: typeof Linker);
|
|
20
|
-
/**
|
|
21
|
-
* Take the item from the front of the queue.
|
|
22
|
-
* @
|
|
23
|
-
*/
|
|
24
|
-
dequeue(): T | null;
|
|
25
|
-
/**
|
|
26
|
-
* Check whether the queue has no items.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* @returns {Queue}
|
|
57
|
-
*/
|
|
58
|
-
static fromArray: <T_1 = any>(values?: Array<T_1>, listClass?: any, linkerClass?: typeof Linker) => Queue<T_1>;
|
|
59
|
-
}
|
|
1
|
+
import { Linker } from '../linked-list/Linker';
|
|
2
|
+
import { IsArrayable } from '../../recipes/IsArrayable';
|
|
3
|
+
import { IsQueue } from '../../recipes/IsQueue';
|
|
4
|
+
/**
|
|
5
|
+
* A first-in-first-out collection: items are added to the back with enqueue and taken from the front with dequeue.
|
|
6
|
+
* Any value can be queued (it is stored as it is, whether it is a function, an object or null), and adding and taking
|
|
7
|
+
* are constant time. To queue tasks which are run as they are taken use TaskQueue.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Queue<T = any> implements IsQueue<T>, Iterable<T> {
|
|
10
|
+
/** The list which stores the queued items, the first is next to be dequeued. */
|
|
11
|
+
queuedList: IsArrayable<any>;
|
|
12
|
+
private readonly linkerClass;
|
|
13
|
+
/**
|
|
14
|
+
* Instantiate the queue, optionally with a list of items to start from.
|
|
15
|
+
* @param queuedList The list of linkers to start in this queue (the first is the front)
|
|
16
|
+
* @param listClass The type of list to create when no queued list is given
|
|
17
|
+
* @param linkerClass The class used to hold each queued item
|
|
18
|
+
*/
|
|
19
|
+
constructor(queuedList?: IsArrayable<any> | null, listClass?: any, linkerClass?: typeof Linker);
|
|
20
|
+
/**
|
|
21
|
+
* Take the item from the front of the queue.
|
|
22
|
+
* @returns The item, or null when the queue is empty
|
|
23
|
+
*/
|
|
24
|
+
dequeue(): T | null;
|
|
25
|
+
/**
|
|
26
|
+
* Check whether the queue has no items.
|
|
27
|
+
*/
|
|
28
|
+
empty(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Add an item to the back of the queue.
|
|
31
|
+
* @param data The item to add
|
|
32
|
+
* @returns This queue, so that adding can be chained
|
|
33
|
+
*/
|
|
34
|
+
enqueue(data: T): this;
|
|
35
|
+
/**
|
|
36
|
+
* Look at the item at the front of the queue, without removing it.
|
|
37
|
+
* @returns The item, or null when the queue is empty
|
|
38
|
+
*/
|
|
39
|
+
peek(): T | null;
|
|
40
|
+
/**
|
|
41
|
+
* Count the items in the queue.
|
|
42
|
+
*/
|
|
43
|
+
size(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Iterate over the items from the front of the queue to the back, without removing them.
|
|
46
|
+
*/
|
|
47
|
+
[Symbol.iterator](): Iterator<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Convert an array to a Queue, the first value is at the front.
|
|
50
|
+
* @param values The items to queue
|
|
51
|
+
* @param listClass The type of list used to store the items
|
|
52
|
+
* @param linkerClass The class used to hold each queued item
|
|
53
|
+
*/
|
|
54
|
+
static fromArray: <T_1 = any>(values?: Array<T_1>, listClass?: any, linkerClass?: typeof Linker) => Queue<T_1>;
|
|
55
|
+
}
|