collect-your-stuff 1.2.5 → 1.2.7
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 +39 -39
- package/browser/collect-your-stuff.js +123 -221
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.js +18 -24
- package/dist/collections/arrayable/ArrayElement.min.js +1 -1
- package/dist/collections/arrayable/Arrayable.js +5 -13
- package/dist/collections/arrayable/Arrayable.min.js +1 -1
- package/dist/collections/doubly-linked-list/DoubleLinker.js +23 -31
- package/dist/collections/doubly-linked-list/DoubleLinker.min.js +1 -1
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +5 -13
- package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -1
- package/dist/collections/linked-list/LinkedList.js +5 -13
- package/dist/collections/linked-list/LinkedList.min.js +1 -1
- package/dist/collections/linked-list/Linker.js +21 -27
- package/dist/collections/linked-list/Linker.min.js +1 -1
- package/dist/collections/linked-tree-list/LinkedTreeList.js +6 -15
- package/dist/collections/linked-tree-list/LinkedTreeList.min.js +1 -1
- package/dist/collections/linked-tree-list/TreeLinker.js +11 -24
- package/dist/collections/linked-tree-list/TreeLinker.min.js +1 -1
- package/dist/collections/queue/Queue.js +2 -8
- package/dist/collections/queue/Queue.min.js +1 -1
- package/dist/collections/queue/Queueable.js +12 -22
- package/dist/collections/queue/Queueable.min.js +1 -1
- package/dist/collections/stack/Stack.js +2 -8
- package/dist/collections/stack/Stack.min.js +1 -1
- package/dist/collections/stack/Stackable.js +7 -15
- package/dist/collections/stack/Stackable.min.js +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/recipes/ArrayIterator.js +1 -2
- package/dist/recipes/ArrayIterator.min.js +1 -1
- package/dist/recipes/Runnable.js +1 -2
- package/dist/recipes/Runnable.min.js +1 -1
- package/dist/services/services.d.ts +1 -1
- package/package.json +2 -2
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
* Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
17
17
|
* @param {*} [data=null] The data to be stored in this element.
|
|
18
18
|
*/
|
|
19
|
-
constructor () {
|
|
20
|
-
const data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
|
|
19
|
+
constructor (data = null) {
|
|
21
20
|
this.classType = ArrayElement
|
|
22
21
|
this.data = null
|
|
23
22
|
this.data = data
|
|
@@ -30,8 +29,7 @@
|
|
|
30
29
|
* @return {ArrayElement}
|
|
31
30
|
*/
|
|
32
31
|
exports.ArrayElement = ArrayElement
|
|
33
|
-
ArrayElement.make =
|
|
34
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ArrayElement
|
|
32
|
+
ArrayElement.make = (element, classType = ArrayElement) => {
|
|
35
33
|
if (typeof element !== 'object') {
|
|
36
34
|
// It is not an object, so instantiate the Element with element as the data
|
|
37
35
|
return new classType(element)
|
|
@@ -49,27 +47,23 @@
|
|
|
49
47
|
* @param {IsElement} [classType=ArrayElement] Provide the type of IsElement to use.
|
|
50
48
|
* @returns {{head: ArrayElement[], tail: ArrayElement}}
|
|
51
49
|
*/
|
|
52
|
-
ArrayElement.fromArray =
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
head: [newElement],
|
|
61
|
-
tail: newElement
|
|
62
|
-
}
|
|
50
|
+
ArrayElement.fromArray = (values = [], classType = ArrayElement) => values.reduce((references, element) => {
|
|
51
|
+
const newElement = classType.make(element, classType)
|
|
52
|
+
if (!references.head.length) {
|
|
53
|
+
// Initialize the head and tail with the new node
|
|
54
|
+
return {
|
|
55
|
+
head: [newElement],
|
|
56
|
+
tail: newElement
|
|
63
57
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
58
|
+
}
|
|
59
|
+
// Only update the tail once head has been set, tail is always the most recent node
|
|
60
|
+
references.head.push(newElement)
|
|
61
|
+
references.tail = newElement
|
|
62
|
+
return references
|
|
63
|
+
}, {
|
|
64
|
+
head: [],
|
|
65
|
+
tail: null
|
|
66
|
+
})
|
|
73
67
|
}, { 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.reduce.js': 626 }],
|
|
74
68
|
2: [function (require, module, exports) {
|
|
75
69
|
'use strict'
|
|
@@ -78,7 +72,6 @@
|
|
|
78
72
|
value: true
|
|
79
73
|
})
|
|
80
74
|
exports.Arrayable = void 0
|
|
81
|
-
require('core-js/modules/web.dom-collections.iterator.js')
|
|
82
75
|
var _ArrayElement = require('./ArrayElement')
|
|
83
76
|
var _ArrayIterator = require('../../recipes/ArrayIterator')
|
|
84
77
|
/**
|
|
@@ -95,8 +88,7 @@
|
|
|
95
88
|
/**
|
|
96
89
|
* Create the new Arrayable instance, configure the Arrayable class.
|
|
97
90
|
*/
|
|
98
|
-
constructor () {
|
|
99
|
-
const elementClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _ArrayElement.ArrayElement
|
|
91
|
+
constructor (elementClass = _ArrayElement.ArrayElement) {
|
|
100
92
|
this.classType = Arrayable
|
|
101
93
|
this.innerList = []
|
|
102
94
|
this.initialized = false
|
|
@@ -180,8 +172,7 @@
|
|
|
180
172
|
* @param {ArrayElement} after The existing last node
|
|
181
173
|
* @returns {Arrayable}
|
|
182
174
|
*/
|
|
183
|
-
append (node) {
|
|
184
|
-
const after = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.last
|
|
175
|
+
append (node, after = this.last) {
|
|
185
176
|
return this.insertAfter(after, node)
|
|
186
177
|
}
|
|
187
178
|
|
|
@@ -191,8 +182,7 @@
|
|
|
191
182
|
* @param {ArrayElement} before The existing first node
|
|
192
183
|
* @returns {Arrayable}
|
|
193
184
|
*/
|
|
194
|
-
prepend (node) {
|
|
195
|
-
const before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.first
|
|
185
|
+
prepend (node, before = this.first) {
|
|
196
186
|
return this.insertBefore(before, node)
|
|
197
187
|
}
|
|
198
188
|
|
|
@@ -236,8 +226,7 @@
|
|
|
236
226
|
* @param {Arrayable} thisArg Optional, 'this' reference
|
|
237
227
|
* @returns {Arrayable}
|
|
238
228
|
*/
|
|
239
|
-
forEach (callback) {
|
|
240
|
-
const thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this
|
|
229
|
+
forEach (callback, thisArg = this) {
|
|
241
230
|
for (let i = 0; i < thisArg.length; ++i) {
|
|
242
231
|
callback(thisArg.item(i), i, thisArg)
|
|
243
232
|
}
|
|
@@ -261,14 +250,11 @@
|
|
|
261
250
|
* @returns {Arrayable}
|
|
262
251
|
*/
|
|
263
252
|
exports.Arrayable = Arrayable
|
|
264
|
-
Arrayable.fromArray =
|
|
265
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
266
|
-
const elementClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _ArrayElement.ArrayElement
|
|
267
|
-
const classType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Arrayable
|
|
253
|
+
Arrayable.fromArray = (values = [], elementClass = _ArrayElement.ArrayElement, classType = Arrayable) => {
|
|
268
254
|
const list = new classType(elementClass)
|
|
269
255
|
return list.initialize(elementClass.fromArray(values).head)
|
|
270
256
|
}
|
|
271
|
-
}, { '../../recipes/ArrayIterator': 14, './ArrayElement': 1
|
|
257
|
+
}, { '../../recipes/ArrayIterator': 14, './ArrayElement': 1 }],
|
|
272
258
|
3: [function (require, module, exports) {
|
|
273
259
|
'use strict'
|
|
274
260
|
|
|
@@ -291,14 +277,11 @@
|
|
|
291
277
|
* @param {DoubleLinker|null} [nodeData.next=null] The reference to the next linker if any
|
|
292
278
|
* @param {DoubleLinker|null} [nodeData.prev=null] The reference to the previous linker if any
|
|
293
279
|
*/
|
|
294
|
-
constructor (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const next = _ref$next === void 0 ? null : _ref$next
|
|
300
|
-
const _ref$prev = _ref.prev
|
|
301
|
-
const prev = _ref$prev === void 0 ? null : _ref$prev
|
|
280
|
+
constructor ({
|
|
281
|
+
data = null,
|
|
282
|
+
next = null,
|
|
283
|
+
prev = null
|
|
284
|
+
} = {}) {
|
|
302
285
|
this.classType = DoubleLinker
|
|
303
286
|
this.data = null
|
|
304
287
|
this.next = null
|
|
@@ -315,8 +298,7 @@
|
|
|
315
298
|
* @return {DoubleLinker}
|
|
316
299
|
*/
|
|
317
300
|
exports.DoubleLinker = DoubleLinker
|
|
318
|
-
DoubleLinker.make =
|
|
319
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DoubleLinker
|
|
301
|
+
DoubleLinker.make = (linker, classType = DoubleLinker) => {
|
|
320
302
|
return _Linker.Linker.make(linker, classType)
|
|
321
303
|
}
|
|
322
304
|
/**
|
|
@@ -325,28 +307,24 @@
|
|
|
325
307
|
* @param {IsDoubleLinker} [classType=DoubleLinker] Provide the type of IsDoubleLinker to use.
|
|
326
308
|
* @returns {{head: DoubleLinker, tail: DoubleLinker}}
|
|
327
309
|
*/
|
|
328
|
-
DoubleLinker.fromArray =
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return {
|
|
336
|
-
head: newLinker,
|
|
337
|
-
tail: newLinker
|
|
338
|
-
}
|
|
310
|
+
DoubleLinker.fromArray = (values = [], classType = DoubleLinker) => values.reduce((references, linker) => {
|
|
311
|
+
const newLinker = classType.make(linker, classType)
|
|
312
|
+
if (references.head === null) {
|
|
313
|
+
// Initialize the head and tail with the new node
|
|
314
|
+
return {
|
|
315
|
+
head: newLinker,
|
|
316
|
+
tail: newLinker
|
|
339
317
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
318
|
+
}
|
|
319
|
+
newLinker.prev = references.tail
|
|
320
|
+
// Only update the tail once head has been set, tail is always the most recent node
|
|
321
|
+
references.tail.next = newLinker
|
|
322
|
+
references.tail = newLinker
|
|
323
|
+
return references
|
|
324
|
+
}, {
|
|
325
|
+
head: null,
|
|
326
|
+
tail: null
|
|
327
|
+
})
|
|
350
328
|
}, { '../linked-list/Linker': 6, 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.reduce.js': 626 }],
|
|
351
329
|
4: [function (require, module, exports) {
|
|
352
330
|
'use strict'
|
|
@@ -357,7 +335,6 @@
|
|
|
357
335
|
exports.DoublyLinkedList = void 0
|
|
358
336
|
require('core-js/modules/esnext.iterator.constructor.js')
|
|
359
337
|
require('core-js/modules/esnext.iterator.for-each.js')
|
|
360
|
-
require('core-js/modules/web.dom-collections.iterator.js')
|
|
361
338
|
var _DoubleLinker = require('./DoubleLinker')
|
|
362
339
|
var _DoubleLinkerIterator = require('../../recipes/DoubleLinkerIterator')
|
|
363
340
|
var _LinkedList = require('../linked-list/LinkedList')
|
|
@@ -376,8 +353,7 @@
|
|
|
376
353
|
/**
|
|
377
354
|
* Create the new DoublyLinkedList instance.
|
|
378
355
|
*/
|
|
379
|
-
constructor () {
|
|
380
|
-
const linkerClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _DoubleLinker.DoubleLinker
|
|
356
|
+
constructor (linkerClass = _DoubleLinker.DoubleLinker) {
|
|
381
357
|
this.classType = DoublyLinkedList
|
|
382
358
|
this.innerList = null
|
|
383
359
|
this.initialized = false
|
|
@@ -500,8 +476,7 @@
|
|
|
500
476
|
* @param {DoubleLinker} after The existing last node
|
|
501
477
|
* @returns {DoubleLinker}
|
|
502
478
|
*/
|
|
503
|
-
append (node) {
|
|
504
|
-
const after = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.last
|
|
479
|
+
append (node, after = this.last) {
|
|
505
480
|
return this.insertAfter(after, node)
|
|
506
481
|
}
|
|
507
482
|
|
|
@@ -511,8 +486,7 @@
|
|
|
511
486
|
* @param {DoubleLinker} before The existing first node
|
|
512
487
|
* @returns {DoubleLinker}
|
|
513
488
|
*/
|
|
514
|
-
prepend (node) {
|
|
515
|
-
const before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.first
|
|
489
|
+
prepend (node, before = this.first) {
|
|
516
490
|
return this.insertBefore(before, node)
|
|
517
491
|
}
|
|
518
492
|
|
|
@@ -598,8 +572,7 @@
|
|
|
598
572
|
* @param {forEachCallback} callback The function to call for-each double linker
|
|
599
573
|
* @param {DoublyLinkedList} thisArg Optional, 'this' reference
|
|
600
574
|
*/
|
|
601
|
-
forEach (callback) {
|
|
602
|
-
const thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this
|
|
575
|
+
forEach (callback, thisArg = this) {
|
|
603
576
|
return _LinkedList.LinkedList.prototype.forEach.call(this, callback, thisArg)
|
|
604
577
|
}
|
|
605
578
|
|
|
@@ -620,13 +593,10 @@
|
|
|
620
593
|
* @returns {DoublyLinkedList}
|
|
621
594
|
*/
|
|
622
595
|
exports.DoublyLinkedList = DoublyLinkedList
|
|
623
|
-
DoublyLinkedList.fromArray =
|
|
624
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
625
|
-
const linkerClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _DoubleLinker.DoubleLinker
|
|
626
|
-
const classType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DoublyLinkedList
|
|
596
|
+
DoublyLinkedList.fromArray = (values = [], linkerClass = _DoubleLinker.DoubleLinker, classType = DoublyLinkedList) => {
|
|
627
597
|
return _LinkedList.LinkedList.fromArray(values, linkerClass, classType)
|
|
628
598
|
}
|
|
629
|
-
}, { '../../recipes/DoubleLinkerIterator': 15, '../linked-list/LinkedList': 5, './DoubleLinker': 3, 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.for-each.js': 624
|
|
599
|
+
}, { '../../recipes/DoubleLinkerIterator': 15, '../linked-list/LinkedList': 5, './DoubleLinker': 3, 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.for-each.js': 624 }],
|
|
630
600
|
5: [function (require, module, exports) {
|
|
631
601
|
'use strict'
|
|
632
602
|
|
|
@@ -634,7 +604,6 @@
|
|
|
634
604
|
value: true
|
|
635
605
|
})
|
|
636
606
|
exports.LinkedList = void 0
|
|
637
|
-
require('core-js/modules/web.dom-collections.iterator.js')
|
|
638
607
|
var _Linker = require('./Linker')
|
|
639
608
|
var _LinkerIterator = require('../../recipes/LinkerIterator')
|
|
640
609
|
var _Arrayable = require('../arrayable/Arrayable')
|
|
@@ -646,8 +615,7 @@
|
|
|
646
615
|
/**
|
|
647
616
|
* Create the new LinkedList instance.
|
|
648
617
|
*/
|
|
649
|
-
constructor () {
|
|
650
|
-
const linkerClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _Linker.Linker
|
|
618
|
+
constructor (linkerClass = _Linker.Linker) {
|
|
651
619
|
this.classType = LinkedList
|
|
652
620
|
this.innerList = null
|
|
653
621
|
this.initialized = false
|
|
@@ -762,8 +730,7 @@
|
|
|
762
730
|
* @param {Linker} after The existing last node
|
|
763
731
|
* @returns {Linker}
|
|
764
732
|
*/
|
|
765
|
-
append (node) {
|
|
766
|
-
const after = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.last
|
|
733
|
+
append (node, after = this.last) {
|
|
767
734
|
return this.insertAfter(after, node)
|
|
768
735
|
}
|
|
769
736
|
|
|
@@ -773,8 +740,7 @@
|
|
|
773
740
|
* @param {Linker} before The existing first node
|
|
774
741
|
* @returns {Linker}
|
|
775
742
|
*/
|
|
776
|
-
prepend (node) {
|
|
777
|
-
const before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.first
|
|
743
|
+
prepend (node, before = this.first) {
|
|
778
744
|
return this.insertBefore(before, node)
|
|
779
745
|
}
|
|
780
746
|
|
|
@@ -834,8 +800,7 @@
|
|
|
834
800
|
* @param {LinkedList} thisArg Optional, 'this' reference
|
|
835
801
|
* @returns {LinkedList}
|
|
836
802
|
*/
|
|
837
|
-
forEach (callback) {
|
|
838
|
-
const thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this
|
|
803
|
+
forEach (callback, thisArg = this) {
|
|
839
804
|
let index = 0
|
|
840
805
|
let current = thisArg.first
|
|
841
806
|
while (current !== null) {
|
|
@@ -862,14 +827,11 @@
|
|
|
862
827
|
* @returns {LinkedList}
|
|
863
828
|
*/
|
|
864
829
|
exports.LinkedList = LinkedList
|
|
865
|
-
LinkedList.fromArray =
|
|
866
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
867
|
-
const linkerClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Linker.Linker
|
|
868
|
-
const classType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LinkedList
|
|
830
|
+
LinkedList.fromArray = (values = [], linkerClass = _Linker.Linker, classType = LinkedList) => {
|
|
869
831
|
const list = new classType(linkerClass)
|
|
870
832
|
return list.initialize(linkerClass.fromArray(values).head)
|
|
871
833
|
}
|
|
872
|
-
}, { '../../recipes/LinkerIterator': 16, '../arrayable/Arrayable': 2, './Linker': 6
|
|
834
|
+
}, { '../../recipes/LinkerIterator': 16, '../arrayable/Arrayable': 2, './Linker': 6 }],
|
|
873
835
|
6: [function (require, module, exports) {
|
|
874
836
|
'use strict'
|
|
875
837
|
|
|
@@ -891,12 +853,10 @@
|
|
|
891
853
|
* @param {*} [nodeData.data=null] The data to be stored in this linker
|
|
892
854
|
* @param {Linker|null} [nodeData.next=null] The reference to the next linker if any
|
|
893
855
|
*/
|
|
894
|
-
constructor (
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
const _ref$next = _ref.next
|
|
899
|
-
const next = _ref$next === void 0 ? null : _ref$next
|
|
856
|
+
constructor ({
|
|
857
|
+
data = null,
|
|
858
|
+
next = null
|
|
859
|
+
} = {}) {
|
|
900
860
|
this.classType = Linker
|
|
901
861
|
this.data = null
|
|
902
862
|
this.next = null
|
|
@@ -911,8 +871,7 @@
|
|
|
911
871
|
* @return {Linker}
|
|
912
872
|
*/
|
|
913
873
|
exports.Linker = Linker
|
|
914
|
-
Linker.make =
|
|
915
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Linker
|
|
874
|
+
Linker.make = (linker, classType = Linker) => {
|
|
916
875
|
if (typeof linker !== 'object') {
|
|
917
876
|
// It is not an object, so instantiate the Linker with element as the data
|
|
918
877
|
return new classType({
|
|
@@ -937,26 +896,23 @@
|
|
|
937
896
|
* @param {IsLinker} [classType=Linker] Provide the type of IsLinker to use.
|
|
938
897
|
* @returns {{head: Linker, tail: Linker}}
|
|
939
898
|
*/
|
|
940
|
-
Linker.fromArray =
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
head: newLinker,
|
|
948
|
-
tail: newLinker
|
|
949
|
-
}
|
|
899
|
+
Linker.fromArray = (values, classType = Linker) => values.reduce((references, linker) => {
|
|
900
|
+
const newLinker = classType.make(linker, classType)
|
|
901
|
+
if (references.head === null) {
|
|
902
|
+
// Initialize the head and tail with the new node
|
|
903
|
+
return {
|
|
904
|
+
head: newLinker,
|
|
905
|
+
tail: newLinker
|
|
950
906
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
907
|
+
}
|
|
908
|
+
// Only update the tail once head has been set, tail is always the most recent node
|
|
909
|
+
references.tail.next = newLinker
|
|
910
|
+
references.tail = newLinker
|
|
911
|
+
return references
|
|
912
|
+
}, {
|
|
913
|
+
head: null,
|
|
914
|
+
tail: null
|
|
915
|
+
})
|
|
960
916
|
}, { '../arrayable/ArrayElement': 1, 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.reduce.js': 626 }],
|
|
961
917
|
7: [function (require, module, exports) {
|
|
962
918
|
'use strict'
|
|
@@ -965,7 +921,6 @@
|
|
|
965
921
|
value: true
|
|
966
922
|
})
|
|
967
923
|
exports.LinkedTreeList = void 0
|
|
968
|
-
require('core-js/modules/web.dom-collections.iterator.js')
|
|
969
924
|
var _TreeLinker = require('./TreeLinker')
|
|
970
925
|
var _TreeLinkerIterator = require('../../recipes/TreeLinkerIterator')
|
|
971
926
|
var _DoublyLinkedList = require('../doubly-linked-list/DoublyLinkedList')
|
|
@@ -984,8 +939,7 @@
|
|
|
984
939
|
/**
|
|
985
940
|
* Create the new LinkedTreeList instance, configure the list class.
|
|
986
941
|
*/
|
|
987
|
-
constructor () {
|
|
988
|
-
const linkerClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _TreeLinker.TreeLinker
|
|
942
|
+
constructor (linkerClass = _TreeLinker.TreeLinker) {
|
|
989
943
|
this.classType = LinkedTreeList
|
|
990
944
|
this.innerList = null
|
|
991
945
|
this.initialized = false
|
|
@@ -1103,8 +1057,7 @@
|
|
|
1103
1057
|
* @param {TreeLinker} item The TreeLinker node that will be the parent of the children
|
|
1104
1058
|
* @param {LinkedTreeList} children The LinkedTreeList which has the child nodes to use
|
|
1105
1059
|
*/
|
|
1106
|
-
setChildren (item) {
|
|
1107
|
-
const children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null
|
|
1060
|
+
setChildren (item, children = null) {
|
|
1108
1061
|
if (Array.from(this).indexOf(item) < 0) {
|
|
1109
1062
|
console.error('item is not a child of this')
|
|
1110
1063
|
}
|
|
@@ -1137,8 +1090,7 @@
|
|
|
1137
1090
|
* @param {TreeLinker} after The existing last node
|
|
1138
1091
|
* @returns {TreeLinker}
|
|
1139
1092
|
*/
|
|
1140
|
-
append (node) {
|
|
1141
|
-
const after = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.last
|
|
1093
|
+
append (node, after = this.last) {
|
|
1142
1094
|
return _DoublyLinkedList.DoublyLinkedList.prototype.append.call(this, node, after)
|
|
1143
1095
|
}
|
|
1144
1096
|
|
|
@@ -1148,8 +1100,7 @@
|
|
|
1148
1100
|
* @param {TreeLinker} before The existing first node
|
|
1149
1101
|
* @returns {TreeLinker}
|
|
1150
1102
|
*/
|
|
1151
|
-
prepend (node) {
|
|
1152
|
-
const before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.first
|
|
1103
|
+
prepend (node, before = this.first) {
|
|
1153
1104
|
return _DoublyLinkedList.DoublyLinkedList.prototype.prepend.call(this, node, before)
|
|
1154
1105
|
}
|
|
1155
1106
|
|
|
@@ -1184,8 +1135,7 @@
|
|
|
1184
1135
|
* @param {forEachCallback} callback The function to call for-each tree node
|
|
1185
1136
|
* @param {LinkedTreeList} thisArg Optional, 'this' reference
|
|
1186
1137
|
*/
|
|
1187
|
-
forEach (callback) {
|
|
1188
|
-
const thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this
|
|
1138
|
+
forEach (callback, thisArg = this) {
|
|
1189
1139
|
let index = 0
|
|
1190
1140
|
let current = thisArg.first
|
|
1191
1141
|
while (current !== null) {
|
|
@@ -1213,14 +1163,11 @@
|
|
|
1213
1163
|
* @returns {LinkedTreeList}
|
|
1214
1164
|
*/
|
|
1215
1165
|
exports.LinkedTreeList = LinkedTreeList
|
|
1216
|
-
LinkedTreeList.fromArray =
|
|
1217
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
1218
|
-
const linkerClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _TreeLinker.TreeLinker
|
|
1219
|
-
const classType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LinkedTreeList
|
|
1166
|
+
LinkedTreeList.fromArray = (values = [], linkerClass = _TreeLinker.TreeLinker, classType = LinkedTreeList) => {
|
|
1220
1167
|
const list = new classType(linkerClass)
|
|
1221
1168
|
return list.initialize(linkerClass.fromArray(values).head)
|
|
1222
1169
|
}
|
|
1223
|
-
}, { '../../recipes/TreeLinkerIterator': 18, '../doubly-linked-list/DoublyLinkedList': 4, './TreeLinker': 8
|
|
1170
|
+
}, { '../../recipes/TreeLinkerIterator': 18, '../doubly-linked-list/DoublyLinkedList': 4, './TreeLinker': 8 }],
|
|
1224
1171
|
8: [function (require, module, exports) {
|
|
1225
1172
|
'use strict'
|
|
1226
1173
|
|
|
@@ -1247,20 +1194,14 @@
|
|
|
1247
1194
|
* @param {TreeLinker} [settings.parent=null] The reference to a parent linker if any
|
|
1248
1195
|
* @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
|
|
1249
1196
|
*/
|
|
1250
|
-
constructor (
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
const _ref$children = _ref.children
|
|
1259
|
-
const children = _ref$children === void 0 ? null : _ref$children
|
|
1260
|
-
const _ref$parent = _ref.parent
|
|
1261
|
-
const parent = _ref$parent === void 0 ? null : _ref$parent
|
|
1262
|
-
const _ref$listClass = _ref.listClass
|
|
1263
|
-
const listClass = _ref$listClass === void 0 ? _LinkedTreeList.LinkedTreeList : _ref$listClass
|
|
1197
|
+
constructor ({
|
|
1198
|
+
data = null,
|
|
1199
|
+
next = null,
|
|
1200
|
+
prev = null,
|
|
1201
|
+
children = null,
|
|
1202
|
+
parent = null,
|
|
1203
|
+
listClass = _LinkedTreeList.LinkedTreeList
|
|
1204
|
+
} = {}) {
|
|
1264
1205
|
this.classType = TreeLinker
|
|
1265
1206
|
this.data = null
|
|
1266
1207
|
this.next = null
|
|
@@ -1280,9 +1221,7 @@
|
|
|
1280
1221
|
* @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
|
|
1281
1222
|
* @return {LinkedTreeList|null}
|
|
1282
1223
|
*/
|
|
1283
|
-
childrenFromArray () {
|
|
1284
|
-
const children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
|
|
1285
|
-
const listClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _LinkedTreeList.LinkedTreeList
|
|
1224
|
+
childrenFromArray (children = null, listClass = _LinkedTreeList.LinkedTreeList) {
|
|
1286
1225
|
if (children === null) {
|
|
1287
1226
|
return null
|
|
1288
1227
|
}
|
|
@@ -1299,8 +1238,7 @@
|
|
|
1299
1238
|
* @return {TreeLinker}
|
|
1300
1239
|
*/
|
|
1301
1240
|
exports.TreeLinker = TreeLinker
|
|
1302
|
-
TreeLinker.make =
|
|
1303
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TreeLinker
|
|
1241
|
+
TreeLinker.make = (linker, classType = TreeLinker) => {
|
|
1304
1242
|
return _DoubleLinker.DoubleLinker.make(linker, classType)
|
|
1305
1243
|
}
|
|
1306
1244
|
/**
|
|
@@ -1309,11 +1247,7 @@
|
|
|
1309
1247
|
* @param {IsTreeNode} [classType=TreeLinker] Provide the type of IsTreeNode to use.
|
|
1310
1248
|
* @returns {{head: TreeLinker, tail: TreeLinker}}
|
|
1311
1249
|
*/
|
|
1312
|
-
TreeLinker.fromArray =
|
|
1313
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
1314
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TreeLinker
|
|
1315
|
-
return _DoubleLinker.DoubleLinker.fromArray(values, classType)
|
|
1316
|
-
}
|
|
1250
|
+
TreeLinker.fromArray = (values = [], classType = TreeLinker) => _DoubleLinker.DoubleLinker.fromArray(values, classType)
|
|
1317
1251
|
}, { '../doubly-linked-list/DoubleLinker': 3, './LinkedTreeList': 7, 'core-js/modules/esnext.iterator.constructor.js': 623, 'core-js/modules/esnext.iterator.map.js': 625 }],
|
|
1318
1252
|
9: [function (require, module, exports) {
|
|
1319
1253
|
'use strict'
|
|
@@ -1341,10 +1275,7 @@
|
|
|
1341
1275
|
* @param {IsArrayable} listClass
|
|
1342
1276
|
* @param {Queueable} queueableClass
|
|
1343
1277
|
*/
|
|
1344
|
-
constructor () {
|
|
1345
|
-
let queuedList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
|
|
1346
|
-
const listClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _LinkedList.LinkedList
|
|
1347
|
-
const queueableClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _Queueable.Queueable
|
|
1278
|
+
constructor (queuedList = null, listClass = _LinkedList.LinkedList, queueableClass = _Queueable.Queueable) {
|
|
1348
1279
|
this.listClass = listClass
|
|
1349
1280
|
this.queueableClass = queueableClass
|
|
1350
1281
|
if (queuedList === null) {
|
|
@@ -1444,10 +1375,7 @@
|
|
|
1444
1375
|
* @returns {Queue}
|
|
1445
1376
|
*/
|
|
1446
1377
|
exports.Queue = Queue
|
|
1447
|
-
Queue.fromArray =
|
|
1448
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
1449
|
-
const queueableClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Queueable.Queueable
|
|
1450
|
-
const listClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _LinkedList.LinkedList
|
|
1378
|
+
Queue.fromArray = (values = [], queueableClass = _Queueable.Queueable, listClass = _LinkedList.LinkedList) => {
|
|
1451
1379
|
const list = new listClass(queueableClass)
|
|
1452
1380
|
list.initialize(queueableClass.fromArray(values, queueableClass).head)
|
|
1453
1381
|
return new Queue(list, listClass, queueableClass)
|
|
@@ -1473,14 +1401,11 @@
|
|
|
1473
1401
|
* @param {Queueable|null} [queueableData.next=null] The reference to the next queueable if any
|
|
1474
1402
|
* @param {boolean|Function} [queueableData.ready=false] Indicate if the queueable is ready to run
|
|
1475
1403
|
*/
|
|
1476
|
-
constructor (
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
const next = _ref$next === void 0 ? null : _ref$next
|
|
1482
|
-
const _ref$ready = _ref.ready
|
|
1483
|
-
const ready = _ref$ready === void 0 ? false : _ref$ready
|
|
1404
|
+
constructor ({
|
|
1405
|
+
task = null,
|
|
1406
|
+
next = null,
|
|
1407
|
+
ready = false
|
|
1408
|
+
} = {}) {
|
|
1484
1409
|
this.data = null
|
|
1485
1410
|
this.next = null
|
|
1486
1411
|
this.complete = false
|
|
@@ -1523,14 +1448,11 @@
|
|
|
1523
1448
|
* @param {*} [completeResponse.context=null] Provide additional data in the response
|
|
1524
1449
|
* @return {completeResponse}
|
|
1525
1450
|
*/
|
|
1526
|
-
markCompleted (
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
const error = _ref2$error === void 0 ? false : _ref2$error
|
|
1532
|
-
const _ref2$context = _ref2.context
|
|
1533
|
-
const context = _ref2$context === void 0 ? null : _ref2$context
|
|
1451
|
+
markCompleted ({
|
|
1452
|
+
success = true,
|
|
1453
|
+
error = false,
|
|
1454
|
+
context = null
|
|
1455
|
+
} = {}) {
|
|
1534
1456
|
this.complete = true
|
|
1535
1457
|
this.running = false
|
|
1536
1458
|
return {
|
|
@@ -1573,8 +1495,7 @@
|
|
|
1573
1495
|
* @return {Queueable}
|
|
1574
1496
|
*/
|
|
1575
1497
|
exports.Queueable = Queueable
|
|
1576
|
-
Queueable.make =
|
|
1577
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Queueable
|
|
1498
|
+
Queueable.make = (queueable, classType = Queueable) => {
|
|
1578
1499
|
if (typeof queueable !== 'object') {
|
|
1579
1500
|
// It is not an object, so instantiate the Queueable with an element as the data
|
|
1580
1501
|
return new classType({
|
|
@@ -1601,10 +1522,7 @@
|
|
|
1601
1522
|
* @param {IsLinker} [classType=Queueable] Provide the type of IsLinker to use.
|
|
1602
1523
|
* @returns {{head: Queueable, tail: Queueable}}
|
|
1603
1524
|
*/
|
|
1604
|
-
Queueable.fromArray =
|
|
1605
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Queueable
|
|
1606
|
-
return _Linker.Linker.fromArray(values, classType)
|
|
1607
|
-
}
|
|
1525
|
+
Queueable.fromArray = (values, classType = Queueable) => _Linker.Linker.fromArray(values, classType)
|
|
1608
1526
|
}, { '../linked-list/Linker': 6 }],
|
|
1609
1527
|
11: [function (require, module, exports) {
|
|
1610
1528
|
'use strict'
|
|
@@ -1632,10 +1550,7 @@
|
|
|
1632
1550
|
* @param {IsArrayable} listClass
|
|
1633
1551
|
* @param {Stackable} stackableClass
|
|
1634
1552
|
*/
|
|
1635
|
-
constructor () {
|
|
1636
|
-
let stackedList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
|
|
1637
|
-
const listClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _LinkedList.LinkedList
|
|
1638
|
-
const stackableClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _Stackable.Stackable
|
|
1553
|
+
constructor (stackedList = null, listClass = _LinkedList.LinkedList, stackableClass = _Stackable.Stackable) {
|
|
1639
1554
|
this.listClass = listClass
|
|
1640
1555
|
this.stackableClass = stackableClass
|
|
1641
1556
|
if (stackedList === null) {
|
|
@@ -1711,10 +1626,7 @@
|
|
|
1711
1626
|
* @returns {Stack}
|
|
1712
1627
|
*/
|
|
1713
1628
|
exports.Stack = Stack
|
|
1714
|
-
Stack.fromArray =
|
|
1715
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
1716
|
-
const stackableClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Stackable.Stackable
|
|
1717
|
-
const listClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _LinkedList.LinkedList
|
|
1629
|
+
Stack.fromArray = (values = [], stackableClass = _Stackable.Stackable, listClass = _LinkedList.LinkedList) => {
|
|
1718
1630
|
const list = new listClass(stackableClass)
|
|
1719
1631
|
list.initialize(stackableClass.fromArray(values, stackableClass).head)
|
|
1720
1632
|
return new Stack(list)
|
|
@@ -1740,14 +1652,11 @@
|
|
|
1740
1652
|
* @param {Stackable|null} [stackData.next=null] The reference to the next stackable if any
|
|
1741
1653
|
* @param {boolean|Function} [stackData.ready=false] Indicate if the stackable is ready to run
|
|
1742
1654
|
*/
|
|
1743
|
-
constructor (
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
const next = _ref$next === void 0 ? null : _ref$next
|
|
1749
|
-
const _ref$ready = _ref.ready
|
|
1750
|
-
const ready = _ref$ready === void 0 ? false : _ref$ready
|
|
1655
|
+
constructor ({
|
|
1656
|
+
task = null,
|
|
1657
|
+
next = null,
|
|
1658
|
+
ready = false
|
|
1659
|
+
} = {}) {
|
|
1751
1660
|
this.data = null
|
|
1752
1661
|
this.next = null
|
|
1753
1662
|
this.classType = Stackable
|
|
@@ -1781,8 +1690,7 @@
|
|
|
1781
1690
|
* @return {Stackable}
|
|
1782
1691
|
*/
|
|
1783
1692
|
exports.Stackable = Stackable
|
|
1784
|
-
Stackable.make =
|
|
1785
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Stackable
|
|
1693
|
+
Stackable.make = (stackable, classType = Stackable) => {
|
|
1786
1694
|
if (typeof stackable !== 'object') {
|
|
1787
1695
|
// It is not an object, so instantiate the Stackable with stackable as the data
|
|
1788
1696
|
return new classType({
|
|
@@ -1807,11 +1715,7 @@
|
|
|
1807
1715
|
* @param {IsLinker} [classType=Stackable] Provide the type of IsLinker to use.
|
|
1808
1716
|
* @returns {{head: Stackable, tail: Stackable}}
|
|
1809
1717
|
*/
|
|
1810
|
-
Stackable.fromArray =
|
|
1811
|
-
const values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []
|
|
1812
|
-
const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Stackable
|
|
1813
|
-
return _Linker.Linker.fromArray(values, classType)
|
|
1814
|
-
}
|
|
1718
|
+
Stackable.fromArray = (values = [], classType = Stackable) => _Linker.Linker.fromArray(values, classType)
|
|
1815
1719
|
}, { '../linked-list/Linker': 6 }],
|
|
1816
1720
|
13: [function (require, module, exports) {
|
|
1817
1721
|
'use strict'
|
|
@@ -1876,8 +1780,7 @@
|
|
|
1876
1780
|
* Class ArrayIterator returns the next value when using elements of array type list.
|
|
1877
1781
|
*/
|
|
1878
1782
|
class ArrayIterator {
|
|
1879
|
-
constructor (innerList) {
|
|
1880
|
-
const index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0
|
|
1783
|
+
constructor (innerList, index = 0) {
|
|
1881
1784
|
this.innerList = innerList
|
|
1882
1785
|
this.index = index
|
|
1883
1786
|
}
|
|
@@ -1970,8 +1873,7 @@
|
|
|
1970
1873
|
* Instantiate a Runnable class.
|
|
1971
1874
|
* @param {*} data
|
|
1972
1875
|
*/
|
|
1973
|
-
constructor () {
|
|
1974
|
-
const data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
|
|
1876
|
+
constructor (data = null) {
|
|
1975
1877
|
this.data = null
|
|
1976
1878
|
this.data = data
|
|
1977
1879
|
}
|