collect-your-stuff 1.2.7 → 1.2.8
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 +2525 -2525
- package/browser/collect-your-stuff.js +22766 -22761
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +36 -36
- package/dist/collections/arrayable/ArrayElement.js +64 -64
- package/dist/collections/arrayable/Arrayable.d.ts +108 -108
- package/dist/collections/arrayable/Arrayable.js +188 -188
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +46 -46
- package/dist/collections/doubly-linked-list/DoubleLinker.js +69 -69
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +113 -113
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +274 -269
- package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -1
- package/dist/collections/linked-list/LinkedList.d.ts +109 -109
- package/dist/collections/linked-list/LinkedList.js +233 -233
- package/dist/collections/linked-list/Linker.d.ts +43 -43
- package/dist/collections/linked-list/Linker.js +80 -80
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +135 -135
- package/dist/collections/linked-tree-list/LinkedTreeList.js +252 -252
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +63 -63
- package/dist/collections/linked-tree-list/TreeLinker.js +79 -79
- package/dist/collections/queue/Queue.d.ts +63 -63
- package/dist/collections/queue/Queue.js +130 -130
- package/dist/collections/queue/Queueable.d.ts +77 -77
- package/dist/collections/queue/Queueable.js +141 -141
- package/dist/collections/stack/Stack.d.ts +63 -63
- package/dist/collections/stack/Stack.js +106 -106
- package/dist/collections/stack/Stackable.d.ts +56 -56
- package/dist/collections/stack/Stackable.js +83 -83
- package/dist/main.d.ts +40 -40
- package/dist/main.js +50 -50
- package/dist/recipes/ArrayIterator.d.ts +10 -10
- package/dist/recipes/ArrayIterator.js +29 -29
- package/dist/recipes/DoubleLinkerIterator.d.ts +9 -9
- package/dist/recipes/DoubleLinkerIterator.js +24 -24
- 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/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 +9 -9
- package/dist/recipes/LinkerIterator.js +24 -24
- package/dist/recipes/Runnable.d.ts +54 -54
- package/dist/recipes/Runnable.js +68 -68
- package/dist/recipes/TreeLinkerIterator.d.ts +9 -9
- package/dist/recipes/TreeLinkerIterator.js +25 -25
- package/dist/recipes/recipes.d.ts +15 -15
- package/dist/recipes/recipes.js +22 -22
- package/dist/services/parseTree.d.ts +9 -9
- package/dist/services/parseTree.js +24 -24
- package/dist/services/parseTreeNext.d.ts +14 -14
- package/dist/services/parseTreeNext.js +47 -47
- package/dist/services/services.d.ts +13 -13
- package/dist/services/services.js +22 -22
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file linked list item.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.1.0
|
|
5
|
-
* @memberOf module:collect-your-stuff
|
|
6
|
-
*/
|
|
7
|
-
import { IsElement } from '../../recipes/IsElement';
|
|
8
|
-
/**
|
|
9
|
-
* Element represents a node in an Arrayable.
|
|
10
|
-
*/
|
|
11
|
-
export declare class ArrayElement implements IsElement {
|
|
12
|
-
readonly classType: typeof ArrayElement;
|
|
13
|
-
data: any;
|
|
14
|
-
/**
|
|
15
|
-
* Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
16
|
-
* @param {*} [data=null] The data to be stored in this element.
|
|
17
|
-
*/
|
|
18
|
-
constructor(data?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Make a new Element from the data given if it is not already a valid Element.
|
|
21
|
-
* @param {ArrayElement|*} element Return a valid ArrayElement instance from given data, or even an already valid one.
|
|
22
|
-
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
23
|
-
* @return {ArrayElement}
|
|
24
|
-
*/
|
|
25
|
-
static make: (element: ArrayElement | any, classType?: any) => IsElement | any;
|
|
26
|
-
/**
|
|
27
|
-
* Convert an array into Element instances, return the head and tail Elements.
|
|
28
|
-
* @param {Array<IsElement>} [values=[]] Provide an array of data that will be converted to array of elements.
|
|
29
|
-
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
30
|
-
* @returns {{head: ArrayElement[], tail: ArrayElement}}
|
|
31
|
-
*/
|
|
32
|
-
static fromArray: (values?: Array<IsElement>, classType?: any) => {
|
|
33
|
-
head: Array<ArrayElement>;
|
|
34
|
-
tail: ArrayElement;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file linked list item.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.1.0
|
|
5
|
+
* @memberOf module:collect-your-stuff
|
|
6
|
+
*/
|
|
7
|
+
import { IsElement } from '../../recipes/IsElement';
|
|
8
|
+
/**
|
|
9
|
+
* Element represents a node in an Arrayable.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ArrayElement implements IsElement {
|
|
12
|
+
readonly classType: typeof ArrayElement;
|
|
13
|
+
data: any;
|
|
14
|
+
/**
|
|
15
|
+
* Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
16
|
+
* @param {*} [data=null] The data to be stored in this element.
|
|
17
|
+
*/
|
|
18
|
+
constructor(data?: any);
|
|
19
|
+
/**
|
|
20
|
+
* Make a new Element from the data given if it is not already a valid Element.
|
|
21
|
+
* @param {ArrayElement|*} element Return a valid ArrayElement instance from given data, or even an already valid one.
|
|
22
|
+
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
23
|
+
* @return {ArrayElement}
|
|
24
|
+
*/
|
|
25
|
+
static make: (element: ArrayElement | any, classType?: any) => IsElement | any;
|
|
26
|
+
/**
|
|
27
|
+
* Convert an array into Element instances, return the head and tail Elements.
|
|
28
|
+
* @param {Array<IsElement>} [values=[]] Provide an array of data that will be converted to array of elements.
|
|
29
|
+
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
30
|
+
* @returns {{head: ArrayElement[], tail: ArrayElement}}
|
|
31
|
+
*/
|
|
32
|
+
static fromArray: (values?: Array<IsElement>, classType?: any) => {
|
|
33
|
+
head: Array<ArrayElement>;
|
|
34
|
+
tail: ArrayElement;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.ArrayElement = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
-
/**
|
|
10
|
-
* Element represents a node in an Arrayable.
|
|
11
|
-
*/
|
|
12
|
-
class ArrayElement {
|
|
13
|
-
/**
|
|
14
|
-
* Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
15
|
-
* @param {*} [data=null] The data to be stored in this element.
|
|
16
|
-
*/
|
|
17
|
-
constructor (data = null) {
|
|
18
|
-
this.classType = ArrayElement
|
|
19
|
-
this.data = null
|
|
20
|
-
this.data = data
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Make a new Element from the data given if it is not already a valid Element.
|
|
25
|
-
* @param {ArrayElement|*} element Return a valid ArrayElement instance from given data, or even an already valid one.
|
|
26
|
-
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
27
|
-
* @return {ArrayElement}
|
|
28
|
-
*/
|
|
29
|
-
exports.ArrayElement = ArrayElement
|
|
30
|
-
ArrayElement.make = (element, classType = ArrayElement) => {
|
|
31
|
-
if (typeof element !== 'object') {
|
|
32
|
-
// It is not an object, so instantiate the Element with element as the data
|
|
33
|
-
return new classType(element)
|
|
34
|
-
}
|
|
35
|
-
if (element.classType) {
|
|
36
|
-
// Already valid Element, return as-is
|
|
37
|
-
return element
|
|
38
|
-
}
|
|
39
|
-
// Create the new node as the configured #classType
|
|
40
|
-
return new classType(element)
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Convert an array into Element instances, return the head and tail Elements.
|
|
44
|
-
* @param {Array<IsElement>} [values=[]] Provide an array of data that will be converted to array of elements.
|
|
45
|
-
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
46
|
-
* @returns {{head: ArrayElement[], tail: ArrayElement}}
|
|
47
|
-
*/
|
|
48
|
-
ArrayElement.fromArray = (values = [], classType = ArrayElement) => values.reduce((references, element) => {
|
|
49
|
-
const newElement = classType.make(element, classType)
|
|
50
|
-
if (!references.head.length) {
|
|
51
|
-
// Initialize the head and tail with the new node
|
|
52
|
-
return {
|
|
53
|
-
head: [newElement],
|
|
54
|
-
tail: newElement
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Only update the tail once head has been set, tail is always the most recent node
|
|
58
|
-
references.head.push(newElement)
|
|
59
|
-
references.tail = newElement
|
|
60
|
-
return references
|
|
61
|
-
}, {
|
|
62
|
-
head: [],
|
|
63
|
-
tail: null
|
|
64
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.ArrayElement = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
+
/**
|
|
10
|
+
* Element represents a node in an Arrayable.
|
|
11
|
+
*/
|
|
12
|
+
class ArrayElement {
|
|
13
|
+
/**
|
|
14
|
+
* Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
15
|
+
* @param {*} [data=null] The data to be stored in this element.
|
|
16
|
+
*/
|
|
17
|
+
constructor (data = null) {
|
|
18
|
+
this.classType = ArrayElement
|
|
19
|
+
this.data = null
|
|
20
|
+
this.data = data
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Make a new Element from the data given if it is not already a valid Element.
|
|
25
|
+
* @param {ArrayElement|*} element Return a valid ArrayElement instance from given data, or even an already valid one.
|
|
26
|
+
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
27
|
+
* @return {ArrayElement}
|
|
28
|
+
*/
|
|
29
|
+
exports.ArrayElement = ArrayElement
|
|
30
|
+
ArrayElement.make = (element, classType = ArrayElement) => {
|
|
31
|
+
if (typeof element !== 'object') {
|
|
32
|
+
// It is not an object, so instantiate the Element with element as the data
|
|
33
|
+
return new classType(element)
|
|
34
|
+
}
|
|
35
|
+
if (element.classType) {
|
|
36
|
+
// Already valid Element, return as-is
|
|
37
|
+
return element
|
|
38
|
+
}
|
|
39
|
+
// Create the new node as the configured #classType
|
|
40
|
+
return new classType(element)
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert an array into Element instances, return the head and tail Elements.
|
|
44
|
+
* @param {Array<IsElement>} [values=[]] Provide an array of data that will be converted to array of elements.
|
|
45
|
+
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
46
|
+
* @returns {{head: ArrayElement[], tail: ArrayElement}}
|
|
47
|
+
*/
|
|
48
|
+
ArrayElement.fromArray = (values = [], classType = ArrayElement) => values.reduce((references, element) => {
|
|
49
|
+
const newElement = classType.make(element, classType)
|
|
50
|
+
if (!references.head.length) {
|
|
51
|
+
// Initialize the head and tail with the new node
|
|
52
|
+
return {
|
|
53
|
+
head: [newElement],
|
|
54
|
+
tail: newElement
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Only update the tail once head has been set, tail is always the most recent node
|
|
58
|
+
references.head.push(newElement)
|
|
59
|
+
references.tail = newElement
|
|
60
|
+
return references
|
|
61
|
+
}, {
|
|
62
|
+
head: [],
|
|
63
|
+
tail: null
|
|
64
|
+
})
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file arrayable list.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.1.0
|
|
5
|
-
* @memberOf module:collect-your-stuff
|
|
6
|
-
*/
|
|
7
|
-
import { ArrayElement } from './ArrayElement';
|
|
8
|
-
import { forEachCallback, IsArrayable } from '../../recipes/IsArrayable';
|
|
9
|
-
import { IsElement } from '../../recipes/IsElement';
|
|
10
|
-
/**
|
|
11
|
-
* Arrayable represents a collection stored as an array.
|
|
12
|
-
*/
|
|
13
|
-
export declare class Arrayable implements IsArrayable<ArrayElement>, Iterable<ArrayElement> {
|
|
14
|
-
readonly classType: typeof Arrayable;
|
|
15
|
-
innerList: Array<ArrayElement>;
|
|
16
|
-
initialized: boolean;
|
|
17
|
-
elementClass: typeof ArrayElement;
|
|
18
|
-
/**
|
|
19
|
-
* Create the new Arrayable instance, configure the Arrayable class.
|
|
20
|
-
*/
|
|
21
|
-
constructor(elementClass?: typeof ArrayElement);
|
|
22
|
-
/**
|
|
23
|
-
* Initialize the inner list, should only run once.
|
|
24
|
-
* @param {Array<ArrayElement>} initialList Give the array of elements to start in this Arrayable.
|
|
25
|
-
* @return {Arrayable}
|
|
26
|
-
*/
|
|
27
|
-
initialize(initialList: Array<ArrayElement>): Arrayable;
|
|
28
|
-
/**
|
|
29
|
-
* Retrieve a copy of the innerList used.
|
|
30
|
-
* @returns {Array<ArrayElement>}
|
|
31
|
-
*/
|
|
32
|
-
get list(): Array<ArrayElement>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve the first Element from the Arrayable
|
|
35
|
-
* @returns {ArrayElement}
|
|
36
|
-
*/
|
|
37
|
-
get first(): ArrayElement;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve the last Element from the Arrayable
|
|
40
|
-
* @returns {ArrayElement}
|
|
41
|
-
*/
|
|
42
|
-
get last(): ArrayElement;
|
|
43
|
-
/**
|
|
44
|
-
* Return the length of the list.
|
|
45
|
-
* @returns {number}
|
|
46
|
-
*/
|
|
47
|
-
get length(): number;
|
|
48
|
-
/**
|
|
49
|
-
* Insert a new node (or data) after a node.
|
|
50
|
-
* @param {ArrayElement|*} node The existing node as reference
|
|
51
|
-
* @param {ArrayElement|*} newNode The new node to go after the existing node
|
|
52
|
-
* @returns {Arrayable}
|
|
53
|
-
*/
|
|
54
|
-
insertAfter(node: ArrayElement, newNode: ArrayElement | any): Arrayable;
|
|
55
|
-
/**
|
|
56
|
-
* Insert a new node (or data) before a node.
|
|
57
|
-
* @param {ArrayElement|*} node The existing node as reference
|
|
58
|
-
* @param {ArrayElement|*} newNode The new node to go before the existing node
|
|
59
|
-
* @returns {Arrayable}
|
|
60
|
-
*/
|
|
61
|
-
insertBefore(node: ArrayElement, newNode: ArrayElement | any): Arrayable;
|
|
62
|
-
/**
|
|
63
|
-
* Add a node (or data) after the given (or last) node in the list.
|
|
64
|
-
* @param {ArrayElement|*} node The new node to add to the end of the list
|
|
65
|
-
* @param {ArrayElement} after The existing last node
|
|
66
|
-
* @returns {Arrayable}
|
|
67
|
-
*/
|
|
68
|
-
append(node: ArrayElement | any, after?: ArrayElement): Arrayable;
|
|
69
|
-
/**
|
|
70
|
-
* Add a node (or data) before the given (or first) node in the list.
|
|
71
|
-
* @param {ArrayElement|*} node The new node to add to the start of the list
|
|
72
|
-
* @param {ArrayElement} before The existing first node
|
|
73
|
-
* @returns {Arrayable}
|
|
74
|
-
*/
|
|
75
|
-
prepend(node: ArrayElement | any, before?: ArrayElement): Arrayable;
|
|
76
|
-
/**
|
|
77
|
-
* Remove an element from this arrayable.
|
|
78
|
-
* @param {ArrayElement} node The node we wish to remove (and it will be returned after removal)
|
|
79
|
-
* @return {ArrayElement}
|
|
80
|
-
*/
|
|
81
|
-
remove(node: ArrayElement): ArrayElement;
|
|
82
|
-
/**
|
|
83
|
-
* Retrieve an ArrayElement item from this list by numeric index, otherwise return null.
|
|
84
|
-
* @param {number} index The integer number for retrieving a node by position.
|
|
85
|
-
* @return {ArrayElement|null}
|
|
86
|
-
*/
|
|
87
|
-
item(index: number): ArrayElement | null;
|
|
88
|
-
/**
|
|
89
|
-
* Be able to run forEach on this Arrayable to iterate over the elements.
|
|
90
|
-
* @param {forEachCallback} callback The function to call for-each element
|
|
91
|
-
* @param {Arrayable} thisArg Optional, 'this' reference
|
|
92
|
-
* @returns {Arrayable}
|
|
93
|
-
*/
|
|
94
|
-
forEach(callback: forEachCallback, thisArg?: Arrayable): Arrayable;
|
|
95
|
-
/**
|
|
96
|
-
* Be able to iterate over this class.
|
|
97
|
-
* @returns {Iterator}
|
|
98
|
-
*/
|
|
99
|
-
[Symbol.iterator](): Iterator<ArrayElement>;
|
|
100
|
-
/**
|
|
101
|
-
* Convert an array to an Arrayable.
|
|
102
|
-
* @param {Array} values An array of values which will be converted to elements in this arrayable
|
|
103
|
-
* @param {IsElement} [elementClass=ArrayElement] The class to use for each element
|
|
104
|
-
* @param {IsArrayable<ArrayElement>} [classType=Arrayable] Provide the type of IsArrayable to use.
|
|
105
|
-
* @returns {Arrayable}
|
|
106
|
-
*/
|
|
107
|
-
static fromArray: (values?: Array<any>, elementClass?: typeof ArrayElement, classType?: any) => IsArrayable<IsElement>;
|
|
108
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file arrayable list.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.1.0
|
|
5
|
+
* @memberOf module:collect-your-stuff
|
|
6
|
+
*/
|
|
7
|
+
import { ArrayElement } from './ArrayElement';
|
|
8
|
+
import { forEachCallback, IsArrayable } from '../../recipes/IsArrayable';
|
|
9
|
+
import { IsElement } from '../../recipes/IsElement';
|
|
10
|
+
/**
|
|
11
|
+
* Arrayable represents a collection stored as an array.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Arrayable implements IsArrayable<ArrayElement>, Iterable<ArrayElement> {
|
|
14
|
+
readonly classType: typeof Arrayable;
|
|
15
|
+
innerList: Array<ArrayElement>;
|
|
16
|
+
initialized: boolean;
|
|
17
|
+
elementClass: typeof ArrayElement;
|
|
18
|
+
/**
|
|
19
|
+
* Create the new Arrayable instance, configure the Arrayable class.
|
|
20
|
+
*/
|
|
21
|
+
constructor(elementClass?: typeof ArrayElement);
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the inner list, should only run once.
|
|
24
|
+
* @param {Array<ArrayElement>} initialList Give the array of elements to start in this Arrayable.
|
|
25
|
+
* @return {Arrayable}
|
|
26
|
+
*/
|
|
27
|
+
initialize(initialList: Array<ArrayElement>): Arrayable;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve a copy of the innerList used.
|
|
30
|
+
* @returns {Array<ArrayElement>}
|
|
31
|
+
*/
|
|
32
|
+
get list(): Array<ArrayElement>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the first Element from the Arrayable
|
|
35
|
+
* @returns {ArrayElement}
|
|
36
|
+
*/
|
|
37
|
+
get first(): ArrayElement;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieve the last Element from the Arrayable
|
|
40
|
+
* @returns {ArrayElement}
|
|
41
|
+
*/
|
|
42
|
+
get last(): ArrayElement;
|
|
43
|
+
/**
|
|
44
|
+
* Return the length of the list.
|
|
45
|
+
* @returns {number}
|
|
46
|
+
*/
|
|
47
|
+
get length(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Insert a new node (or data) after a node.
|
|
50
|
+
* @param {ArrayElement|*} node The existing node as reference
|
|
51
|
+
* @param {ArrayElement|*} newNode The new node to go after the existing node
|
|
52
|
+
* @returns {Arrayable}
|
|
53
|
+
*/
|
|
54
|
+
insertAfter(node: ArrayElement, newNode: ArrayElement | any): Arrayable;
|
|
55
|
+
/**
|
|
56
|
+
* Insert a new node (or data) before a node.
|
|
57
|
+
* @param {ArrayElement|*} node The existing node as reference
|
|
58
|
+
* @param {ArrayElement|*} newNode The new node to go before the existing node
|
|
59
|
+
* @returns {Arrayable}
|
|
60
|
+
*/
|
|
61
|
+
insertBefore(node: ArrayElement, newNode: ArrayElement | any): Arrayable;
|
|
62
|
+
/**
|
|
63
|
+
* Add a node (or data) after the given (or last) node in the list.
|
|
64
|
+
* @param {ArrayElement|*} node The new node to add to the end of the list
|
|
65
|
+
* @param {ArrayElement} after The existing last node
|
|
66
|
+
* @returns {Arrayable}
|
|
67
|
+
*/
|
|
68
|
+
append(node: ArrayElement | any, after?: ArrayElement): Arrayable;
|
|
69
|
+
/**
|
|
70
|
+
* Add a node (or data) before the given (or first) node in the list.
|
|
71
|
+
* @param {ArrayElement|*} node The new node to add to the start of the list
|
|
72
|
+
* @param {ArrayElement} before The existing first node
|
|
73
|
+
* @returns {Arrayable}
|
|
74
|
+
*/
|
|
75
|
+
prepend(node: ArrayElement | any, before?: ArrayElement): Arrayable;
|
|
76
|
+
/**
|
|
77
|
+
* Remove an element from this arrayable.
|
|
78
|
+
* @param {ArrayElement} node The node we wish to remove (and it will be returned after removal)
|
|
79
|
+
* @return {ArrayElement}
|
|
80
|
+
*/
|
|
81
|
+
remove(node: ArrayElement): ArrayElement;
|
|
82
|
+
/**
|
|
83
|
+
* Retrieve an ArrayElement item from this list by numeric index, otherwise return null.
|
|
84
|
+
* @param {number} index The integer number for retrieving a node by position.
|
|
85
|
+
* @return {ArrayElement|null}
|
|
86
|
+
*/
|
|
87
|
+
item(index: number): ArrayElement | null;
|
|
88
|
+
/**
|
|
89
|
+
* Be able to run forEach on this Arrayable to iterate over the elements.
|
|
90
|
+
* @param {forEachCallback} callback The function to call for-each element
|
|
91
|
+
* @param {Arrayable} thisArg Optional, 'this' reference
|
|
92
|
+
* @returns {Arrayable}
|
|
93
|
+
*/
|
|
94
|
+
forEach(callback: forEachCallback, thisArg?: Arrayable): Arrayable;
|
|
95
|
+
/**
|
|
96
|
+
* Be able to iterate over this class.
|
|
97
|
+
* @returns {Iterator}
|
|
98
|
+
*/
|
|
99
|
+
[Symbol.iterator](): Iterator<ArrayElement>;
|
|
100
|
+
/**
|
|
101
|
+
* Convert an array to an Arrayable.
|
|
102
|
+
* @param {Array} values An array of values which will be converted to elements in this arrayable
|
|
103
|
+
* @param {IsElement} [elementClass=ArrayElement] The class to use for each element
|
|
104
|
+
* @param {IsArrayable<ArrayElement>} [classType=Arrayable] Provide the type of IsArrayable to use.
|
|
105
|
+
* @returns {Arrayable}
|
|
106
|
+
*/
|
|
107
|
+
static fromArray: (values?: Array<any>, elementClass?: typeof ArrayElement, classType?: any) => IsArrayable<IsElement>;
|
|
108
|
+
}
|