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,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
|
|
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
|
|
22
|
-
* @
|
|
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 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
|
+
* @returns 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,105 +1,85 @@
|
|
|
1
|
-
import { IsElement } from './IsElement';
|
|
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
|
-
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
* @param
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
* @param
|
|
78
|
-
* @
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
remove(node: T): T;
|
|
87
|
-
/**
|
|
88
|
-
* Retrieve an element item from this list by numeric index, otherwise return null.
|
|
89
|
-
* @param {number} index
|
|
90
|
-
* @return {IsElement|null}
|
|
91
|
-
*/
|
|
92
|
-
item(index: number): T | null;
|
|
93
|
-
/**
|
|
94
|
-
* Be able to run forEach on this Arrayable to iterate over the elements.
|
|
95
|
-
* @param {forEachCallback} callback
|
|
96
|
-
* @param {IsArrayable} thisArg
|
|
97
|
-
* @returns {IsArrayable}
|
|
98
|
-
*/
|
|
99
|
-
forEach(callback: forEachCallback, thisArg?: IsArrayable<any>): IsArrayable<any>;
|
|
100
|
-
/**
|
|
101
|
-
* Be able to iterate over this class.
|
|
102
|
-
* @returns {Iterator}
|
|
103
|
-
*/
|
|
104
|
-
[Symbol.iterator](): Iterator<T>;
|
|
105
|
-
}
|
|
1
|
+
import { IsElement } from './IsElement';
|
|
2
|
+
export type forEachCallback = (element: IsElement, index?: number, thisArg?: IsArrayable<any>) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Arrayable represents a collection stored as Elements.
|
|
5
|
+
*/
|
|
6
|
+
export interface IsArrayable<T extends IsElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Obnoxious typescript won't let me use typeof this class
|
|
9
|
+
* @property {IsArrayable} classType
|
|
10
|
+
*/
|
|
11
|
+
classType: any;
|
|
12
|
+
/**
|
|
13
|
+
* @property {Array<IsElement> | IsElement | null} innerList
|
|
14
|
+
*/
|
|
15
|
+
innerList: Array<T> | T | null;
|
|
16
|
+
/**
|
|
17
|
+
* @private {boolean} initialized
|
|
18
|
+
*/
|
|
19
|
+
initialized: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the inner list, should only run once.
|
|
22
|
+
* @param initialList
|
|
23
|
+
*/
|
|
24
|
+
initialize(initialList: Array<T> | T): IsArrayable<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve a copy of the innerList used.
|
|
27
|
+
*/
|
|
28
|
+
get list(): Array<IsElement> | IsElement;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve the first Element from the Arrayable
|
|
31
|
+
*/
|
|
32
|
+
get first(): T;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the last Element from the Arrayable
|
|
35
|
+
*/
|
|
36
|
+
get last(): T;
|
|
37
|
+
/**
|
|
38
|
+
* Return the length of the list.
|
|
39
|
+
*/
|
|
40
|
+
get length(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Insert a new node (or data) after a node.
|
|
43
|
+
* @param node
|
|
44
|
+
* @param newNode
|
|
45
|
+
*/
|
|
46
|
+
insertAfter(node: T, newNode: T | any): IsArrayable<any>;
|
|
47
|
+
/**
|
|
48
|
+
* Insert a new node (or data) before a node.
|
|
49
|
+
* @param node
|
|
50
|
+
* @param newNode
|
|
51
|
+
*/
|
|
52
|
+
insertBefore(node: T, newNode: T | any): IsArrayable<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Add a node (or data) after the given (or last) node in the list.
|
|
55
|
+
* @param node
|
|
56
|
+
* @param after
|
|
57
|
+
*/
|
|
58
|
+
append(node: T | any, after?: T): IsArrayable<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Add a node (or data) before the given (or first) node in the list.
|
|
61
|
+
* @param node
|
|
62
|
+
* @param before
|
|
63
|
+
*/
|
|
64
|
+
prepend(node: T | any, before?: T): IsArrayable<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Remove an element from this arrayable.
|
|
67
|
+
* @param node
|
|
68
|
+
*/
|
|
69
|
+
remove(node: T): T;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieve an element item from this list by numeric index, otherwise return null.
|
|
72
|
+
* @param index
|
|
73
|
+
*/
|
|
74
|
+
item(index: number): T | null;
|
|
75
|
+
/**
|
|
76
|
+
* Be able to run forEach on this Arrayable to iterate over the elements.
|
|
77
|
+
* @param callback
|
|
78
|
+
* @param thisArg
|
|
79
|
+
*/
|
|
80
|
+
forEach(callback: forEachCallback, thisArg?: IsArrayable<any>): IsArrayable<any>;
|
|
81
|
+
/**
|
|
82
|
+
* Be able to iterate over this class.
|
|
83
|
+
*/
|
|
84
|
+
[Symbol.iterator](): Iterator<T>;
|
|
85
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IsLinker } from './IsLinker';
|
|
2
|
-
/**
|
|
3
|
-
* Define the common attributes of a DoubleLinker used in a linking structure chained with 'next' and sometimes 'prev'.
|
|
4
|
-
*/
|
|
5
|
-
export interface IsDoubleLinker extends IsLinker {
|
|
6
|
-
/**
|
|
7
|
-
* @property {IsDoubleLinker} [next=null]
|
|
8
|
-
*/
|
|
9
|
-
next: IsDoubleLinker;
|
|
10
|
-
/**
|
|
11
|
-
* @property {IsDoubleLinker} [prev=null]
|
|
12
|
-
*/
|
|
13
|
-
prev: IsDoubleLinker;
|
|
14
|
-
}
|
|
1
|
+
import { IsLinker } from './IsLinker';
|
|
2
|
+
/**
|
|
3
|
+
* Define the common attributes of a DoubleLinker used in a linking structure chained with 'next' and sometimes 'prev'.
|
|
4
|
+
*/
|
|
5
|
+
export interface IsDoubleLinker extends IsLinker {
|
|
6
|
+
/**
|
|
7
|
+
* @property {IsDoubleLinker} [next=null]
|
|
8
|
+
*/
|
|
9
|
+
next: IsDoubleLinker;
|
|
10
|
+
/**
|
|
11
|
+
* @property {IsDoubleLinker} [prev=null]
|
|
12
|
+
*/
|
|
13
|
+
prev: IsDoubleLinker;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define the common attributes of an Element in a list.
|
|
3
|
-
*/
|
|
4
|
-
export interface IsElement {
|
|
5
|
-
/**
|
|
6
|
-
* Obnoxious typescript won't let me use typeof this class
|
|
7
|
-
* @property {IsElement} classType
|
|
8
|
-
*/
|
|
9
|
-
classType: any;
|
|
10
|
-
/**
|
|
11
|
-
* @property {*} data
|
|
12
|
-
*/
|
|
13
|
-
data: any;
|
|
14
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Define the common attributes of an Element in a list.
|
|
3
|
+
*/
|
|
4
|
+
export interface IsElement {
|
|
5
|
+
/**
|
|
6
|
+
* Obnoxious typescript won't let me use typeof this class
|
|
7
|
+
* @property {IsElement} classType
|
|
8
|
+
*/
|
|
9
|
+
classType: any;
|
|
10
|
+
/**
|
|
11
|
+
* @property {*} data
|
|
12
|
+
*/
|
|
13
|
+
data: any;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IsElement } from './IsElement';
|
|
2
|
-
/**
|
|
3
|
-
* Define the common attributes of a Linker used in a linking structure chained with 'next' (and sometimes 'prev').
|
|
4
|
-
*/
|
|
5
|
-
export interface IsLinker extends IsElement {
|
|
6
|
-
/**
|
|
7
|
-
* @property {IsLinker} [next=null]
|
|
8
|
-
*/
|
|
9
|
-
next: IsLinker;
|
|
10
|
-
}
|
|
1
|
+
import { IsElement } from './IsElement';
|
|
2
|
+
/**
|
|
3
|
+
* Define the common attributes of a Linker used in a linking structure chained with 'next' (and sometimes 'prev').
|
|
4
|
+
*/
|
|
5
|
+
export interface IsLinker extends IsElement {
|
|
6
|
+
/**
|
|
7
|
+
* @property {IsLinker} [next=null]
|
|
8
|
+
*/
|
|
9
|
+
next: IsLinker;
|
|
10
|
+
}
|
package/dist/recipes/IsLinker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,37 +1,32 @@
|
|
|
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
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Count the items in the queue.
|
|
34
|
-
* @return {number}
|
|
35
|
-
*/
|
|
36
|
-
size: () => number;
|
|
37
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Queue recipe.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Define a first-in-first-out queue: items are added to the back (enqueue) and taken from the front (dequeue).
|
|
6
|
+
* This is the shape which si-funciona's queueManager / queueTimeout expect of a queue.
|
|
7
|
+
*/
|
|
8
|
+
export interface IsQueue<T = any> {
|
|
9
|
+
/**
|
|
10
|
+
* Take the item from the front of the queue.
|
|
11
|
+
* @returns The item, or null when the queue is empty
|
|
12
|
+
*/
|
|
13
|
+
dequeue: () => T | null;
|
|
14
|
+
/**
|
|
15
|
+
* Check whether the queue has no items.
|
|
16
|
+
*/
|
|
17
|
+
empty: () => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Add an item to the back of the queue.
|
|
20
|
+
* @param data The item to add
|
|
21
|
+
*/
|
|
22
|
+
enqueue: (data: T) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Look at the item at the front of the queue, without removing it.
|
|
25
|
+
* @returns The item, or null when the queue is empty
|
|
26
|
+
*/
|
|
27
|
+
peek: () => T | null;
|
|
28
|
+
/**
|
|
29
|
+
* Count the items in the queue.
|
|
30
|
+
*/
|
|
31
|
+
size: () => number;
|
|
32
|
+
}
|
package/dist/recipes/IsQueue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScopedCollection recipe.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Define a keyed collection partitioned by scope: every scope has its own independent key space, and a scope
|
|
6
|
+
* that is no longer referenced anywhere else takes its whole key space with it.
|
|
7
|
+
*/
|
|
8
|
+
export interface IsScopedCollection<Scope extends object = object, Key = any, Value = any> {
|
|
9
|
+
/**
|
|
10
|
+
* Remove a key from a scope's key space.
|
|
11
|
+
* @returns Whether a value was actually removed
|
|
12
|
+
*/
|
|
13
|
+
delete: (scope: Scope, key: Key) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Look up a value by key within a scope.
|
|
16
|
+
* @returns The value, or undefined when the scope or key is not present
|
|
17
|
+
*/
|
|
18
|
+
get: (scope: Scope, key: Key) => Value | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a key exists within a scope.
|
|
21
|
+
*/
|
|
22
|
+
has: (scope: Scope, key: Key) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Store a value under a key within a scope.
|
|
25
|
+
*/
|
|
26
|
+
set: (scope: Scope, key: Key, value: Value) => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,36 +1,31 @@
|
|
|
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
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* Count the items in the stack.
|
|
33
|
-
* @return {number}
|
|
34
|
-
*/
|
|
35
|
-
size: () => number;
|
|
36
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Stack recipe.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Define a last-in-first-out stack: items are added to the top (push) and taken from the top (pop).
|
|
6
|
+
*/
|
|
7
|
+
export interface IsStack<T = any> {
|
|
8
|
+
/**
|
|
9
|
+
* Check whether the stack has no items.
|
|
10
|
+
*/
|
|
11
|
+
empty: () => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Look at the item on the top of the stack, without removing it.
|
|
14
|
+
* @returns The item, or null when the stack is empty
|
|
15
|
+
*/
|
|
16
|
+
peek: () => T | null;
|
|
17
|
+
/**
|
|
18
|
+
* Take the item from the top of the stack.
|
|
19
|
+
* @returns The item, or null when the stack is empty
|
|
20
|
+
*/
|
|
21
|
+
pop: () => T | null;
|
|
22
|
+
/**
|
|
23
|
+
* Add an item to the top of the stack.
|
|
24
|
+
* @param data The item to add
|
|
25
|
+
*/
|
|
26
|
+
push: (data: T) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Count the items in the stack.
|
|
29
|
+
*/
|
|
30
|
+
size: () => number;
|
|
31
|
+
}
|
package/dist/recipes/IsStack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
package/dist/recipes/IsTree.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IsTreeNode } from './IsTreeNode';
|
|
2
|
-
import { IsArrayable } from './IsArrayable';
|
|
3
|
-
/**
|
|
4
|
-
* Arrayable represents a collection stored as Elements.
|
|
5
|
-
*/
|
|
6
|
-
export interface IsTree extends IsArrayable<IsTreeNode> {
|
|
7
|
-
/**
|
|
8
|
-
* @property {IsTreeNode} rootParent
|
|
9
|
-
*/
|
|
10
|
-
rootParent: IsTreeNode;
|
|
11
|
-
}
|
|
1
|
+
import { IsTreeNode } from './IsTreeNode';
|
|
2
|
+
import { IsArrayable } from './IsArrayable';
|
|
3
|
+
/**
|
|
4
|
+
* Arrayable represents a collection stored as Elements.
|
|
5
|
+
*/
|
|
6
|
+
export interface IsTree extends IsArrayable<IsTreeNode> {
|
|
7
|
+
/**
|
|
8
|
+
* @property {IsTreeNode} rootParent
|
|
9
|
+
*/
|
|
10
|
+
rootParent: IsTreeNode;
|
|
11
|
+
}
|
package/dist/recipes/IsTree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|