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,71 +1,65 @@
1
- /**
2
- * @file doubly linked tree node.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.1.0
5
- * @memberOf module:collect-your-stuff
6
- */
7
- import { IsArrayable } from '../../recipes/IsArrayable';
8
- import { IsTreeNode } from '../../recipes/IsTreeNode';
9
- import { IsTree } from '../../recipes/IsTree';
10
- /**
11
- * TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
12
- * @extends DoubleLinker
13
- */
14
- export declare class TreeLinker implements IsTreeNode {
15
- /** The class used to create this instance, so that it can be recognized as valid without an instanceof check. */
16
- readonly classType: typeof TreeLinker;
17
- /** The data stored in this tree node. */
18
- data: any;
19
- /** The sibling after this node, or null when this is the last child. */
20
- next: IsTreeNode | null;
21
- /** The sibling before this node, or null when this is the first child. */
22
- prev: IsTreeNode | null;
23
- /** The node this node is a child of, or null for a root node. */
24
- parent: IsTreeNode;
25
- /** The list of the children of this node, or null when it has none. */
26
- children: IsArrayable<IsTreeNode>;
27
- /**
28
- * Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
29
- * @param {Object} [settings={}] The settings for the new tree node.
30
- * @param {*} [settings.data=null] The data to be stored in this tree node
31
- * @param {TreeLinker} [settings.next=null] The reference to the next linker if any
32
- * @param {TreeLinker} [settings.prev=null] The reference to the previous linker if any
33
- * @param {LinkedTreeList} [settings.children=null] The references to child linkers if any
34
- * @param {TreeLinker} [settings.parent=null] The reference to a parent linker if any
35
- * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
36
- */
37
- constructor({ data, next, prev, children, parent, listClass }?: {
38
- data?: any;
39
- next?: IsTreeNode;
40
- prev?: IsTreeNode;
41
- children?: Array<any>;
42
- parent?: IsTreeNode;
43
- listClass?: any;
44
- });
45
- /**
46
- * Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
47
- * existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
48
- * else is the data of the linker.
49
- * @param {Array|null} children Provide an array of data / linker references to be children of this tree node.
50
- * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
51
- * @return {LinkedTreeList|null}
52
- */
53
- childrenFromArray(children?: Array<any> | null, listClass?: any): IsTree | any;
54
- /**
55
- * Make a new DoubleLinker from the data given if it is not already a valid Linker.
56
- * @param {TreeLinker|*} linker Return a valid TreeLinker instance from given data, or even an already valid one.
57
- * @param {IsTreeNode} [classType=TreeLinker] Provide the type of IsTreeNode to use.
58
- * @return {TreeLinker}
59
- */
60
- static make: (linker: TreeLinker | any, classType?: any) => IsTreeNode | any;
61
- /**
62
- * Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
63
- * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of tree-linkers.
64
- * @param {IsTreeNode} [classType=TreeLinker] Provide the type of IsTreeNode to use.
65
- * @returns {{head: TreeLinker, tail: TreeLinker}}
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
- var _DoubleLinker = require('../doubly-linked-list/DoubleLinker')
10
- var _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 {Object} [settings={}] The settings for the new tree node.
19
- * @param {*} [settings.data=null] The data to be stored in this tree node
20
- * @param {TreeLinker} [settings.next=null] The reference to the next linker if any
21
- * @param {TreeLinker} [settings.prev=null] The reference to the previous linker if any
22
- * @param {LinkedTreeList} [settings.children=null] The references to child linkers if any
23
- * @param {TreeLinker} [settings.parent=null] The reference to a parent linker if any
24
- * @param {IsArrayable<IsTreeNode>} 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 {Array|null} children Provide an array of data / linker references to be children of this tree node.
58
- * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
59
- * @return {LinkedTreeList|null}
60
- */
61
- childrenFromArray (children = null, listClass = _LinkedTreeList.LinkedTreeList) {
62
- if (children === null) {
63
- return null
64
- }
65
- // 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
66
- // given this node as its parent
67
- const nodes = children.map(child => {
68
- const linker = this.classType.make(child, this.classType)
69
- linker.parent = this
70
- return linker
71
- })
72
- // Creates a linked-tree-list to store the children, which remembers this node as its parent even when it is empty
73
- const list = listClass.fromArray(nodes, this.classType)
74
- list.parent = this
75
- return list
76
- }
77
- }
78
- /**
79
- * Make a new DoubleLinker from the data given if it is not already a valid Linker.
80
- * @param {TreeLinker|*} linker Return a valid TreeLinker instance from given data, or even an already valid one.
81
- * @param {IsTreeNode} [classType=TreeLinker] Provide the type of IsTreeNode to use.
82
- * @return {TreeLinker}
83
- */
84
- exports.TreeLinker = TreeLinker
85
- TreeLinker.make = (linker, classType = TreeLinker) => {
86
- return _DoubleLinker.DoubleLinker.make(linker, classType)
87
- }
88
- /**
89
- * Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
90
- * @param {Array} [values=[]] Provide an array of data that will be converted to a chain of tree-linkers.
91
- * @param {IsTreeNode} [classType=TreeLinker] Provide the type of IsTreeNode to use.
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 {IsArrayable|null} [queuedList=null] The list of linkers to start in this queue (the first is the front)
16
- * @param {IsArrayable} [listClass=LinkedList] The type of list to create when no queued list is given
17
- * @param {Linker} [linkerClass=Linker] 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
- * @return {*|null} The item, or null when the queue is empty
23
- */
24
- dequeue(): T | null;
25
- /**
26
- * Check whether the queue has no items.
27
- * @return {boolean}
28
- */
29
- empty(): boolean;
30
- /**
31
- * Add an item to the back of the queue.
32
- * @param {*} data The item to add
33
- * @return {Queue} This queue, so that adding can be chained
34
- */
35
- enqueue(data: T): this;
36
- /**
37
- * Look at the item at the front of the queue, without removing it.
38
- * @return {*|null} The item, or null when the queue is empty
39
- */
40
- peek(): T | null;
41
- /**
42
- * Count the items in the queue.
43
- * @return {number}
44
- */
45
- size(): number;
46
- /**
47
- * Iterate over the items from the front of the queue to the back, without removing them.
48
- * @return {Iterator}
49
- */
50
- [Symbol.iterator](): Iterator<T>;
51
- /**
52
- * Convert an array to a Queue, the first value is at the front.
53
- * @param {Array} [values=[]] The items to queue
54
- * @param {IsArrayable} [listClass=LinkedList] The type of list used to store the items
55
- * @param {Linker} [linkerClass=Linker] The class used to hold each queued item
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
+ }