collect-your-stuff 1.1.2 → 1.1.4

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 CHANGED
@@ -515,16 +515,16 @@ TreeLinker represents a node in a LinkedTreeList having a parent (or root) and c
515
515
  **Extends**: [<code>DoubleLinker</code>](#DoubleLinker)
516
516
 
517
517
  * [TreeLinker](#TreeLinker) ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
518
- * [new TreeLinker([settings])](#new_TreeLinker_new)
518
+ * [new TreeLinker([settings], listClass)](#new_TreeLinker_new)
519
519
  * _instance_
520
- * [.childrenFromArray(children, classType)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
520
+ * [.childrenFromArray(children, listClass)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
521
521
  * _static_
522
522
  * [.make(linker, [classType])](#TreeLinker.make) ⇒ [<code>TreeLinker</code>](#TreeLinker)
523
523
  * [.fromArray([values], [classType])](#TreeLinker.fromArray) ⇒ <code>Object</code>
524
524
 
525
525
  <a name="new_TreeLinker_new"></a>
526
526
 
527
- ### new TreeLinker([settings])
527
+ ### new TreeLinker([settings], listClass)
528
528
  Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
529
529
 
530
530
 
@@ -536,10 +536,11 @@ Create the new TreeLinker instance, provide the data and optionally set referenc
536
536
  | [settings.prev] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the previous linker if any |
537
537
  | [settings.children] | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The references to child linkers if any |
538
538
  | [settings.parent] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to a parent linker if any |
539
+ | listClass | <code>IsArrayable.&lt;IsTreeNode&gt;</code> | | Give the type of list to use for storing the children |
539
540
 
540
541
  <a name="TreeLinker+childrenFromArray"></a>
541
542
 
542
- ### treeLinker.childrenFromArray(children, classType) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
543
+ ### treeLinker.childrenFromArray(children, listClass) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
543
544
  Create the children for this tree from an array.
544
545
 
545
546
  **Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
@@ -547,7 +548,7 @@ Create the children for this tree from an array.
547
548
  | Param | Type | Description |
548
549
  | --- | --- | --- |
549
550
  | children | <code>Array</code> \| <code>null</code> | Provide an array of data / linker references to be children of this tree node. |
550
- | classType | <code>IsTree</code> | Provide the type of IsElement to use. |
551
+ | listClass | <code>IsArrayable.&lt;IsTreeNode&gt;</code> | Give the type of list to use for storing the children |
551
552
 
552
553
  <a name="TreeLinker.make"></a>
553
554
 
@@ -1231,6 +1231,7 @@
1231
1231
  require('core-js/modules/esnext.async-iterator.map.js')
1232
1232
  require('core-js/modules/esnext.iterator.map.js')
1233
1233
  var _DoubleLinker = _interopRequireDefault(require('../doubly-linked-list/DoubleLinker'))
1234
+ var _LinkedTreeList = _interopRequireDefault(require('./LinkedTreeList'))
1234
1235
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
1235
1236
  /**
1236
1237
  * TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
@@ -1245,6 +1246,7 @@
1245
1246
  * @param {TreeLinker} [settings.prev=null] The reference to the previous linker if any
1246
1247
  * @param {LinkedTreeList} [settings.children=null] The references to child linkers if any
1247
1248
  * @param {TreeLinker} [settings.parent=null] The reference to a parent linker if any
1249
+ * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
1248
1250
  */
1249
1251
  constructor () {
1250
1252
  const {
@@ -1252,7 +1254,8 @@
1252
1254
  next = null,
1253
1255
  prev = null,
1254
1256
  children = null,
1255
- parent = null
1257
+ parent = null,
1258
+ listClass = _LinkedTreeList.default
1256
1259
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
1257
1260
  this.classType = TreeLinker
1258
1261
  this.data = null
@@ -1264,25 +1267,25 @@
1264
1267
  this.next = next
1265
1268
  this.prev = prev
1266
1269
  this.parent = parent
1267
- this.children = this.childrenFromArray(children)
1270
+ this.children = this.childrenFromArray(children, listClass)
1268
1271
  }
1269
1272
 
1270
1273
  /**
1271
1274
  * Create the children for this tree from an array.
1272
1275
  * @param {Array|null} children Provide an array of data / linker references to be children of this tree node.
1273
- * @param {IsTree} classType Provide the type of IsElement to use.
1276
+ * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
1274
1277
  * @return {LinkedTreeList|null}
1275
1278
  */
1276
1279
  childrenFromArray () {
1277
1280
  const children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
1278
- const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TreeLinker
1281
+ const listClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _LinkedTreeList.default
1279
1282
  if (children === null) {
1280
1283
  return null
1281
1284
  }
1282
1285
  // Creates a linked-tree-list to store the children.
1283
- return classType.fromArray(children.map(child => Object.assign({}, child, {
1286
+ return listClass.fromArray(children.map(child => Object.assign({}, child, {
1284
1287
  parent: this
1285
- })), classType)
1288
+ })), this.classType)
1286
1289
  }
1287
1290
  }
1288
1291
  /**
@@ -1307,7 +1310,7 @@
1307
1310
  return _DoubleLinker.default.fromArray(values, classType)
1308
1311
  }
1309
1312
  var _default = exports.default = TreeLinker
1310
- }, { '../doubly-linked-list/DoubleLinker': 3, 'core-js/modules/esnext.async-iterator.map.js': 537, 'core-js/modules/esnext.iterator.map.js': 540 }],
1313
+ }, { '../doubly-linked-list/DoubleLinker': 3, './LinkedTreeList': 7, 'core-js/modules/esnext.async-iterator.map.js': 537, 'core-js/modules/esnext.iterator.map.js': 540 }],
1311
1314
  9: [function (require, module, exports) {
1312
1315
  'use strict'
1313
1316