collect-your-stuff 1.1.3 → 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, listType)](#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, listType) ⇒ [<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,8 +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
- | listType | <code>IsArrayable.&lt;IsTree&gt;</code> | Give the type of list to use for storing the children |
551
+ | listClass | <code>IsArrayable.&lt;IsTreeNode&gt;</code> | Give the type of list to use for storing the children |
552
552
 
553
553
  <a name="TreeLinker.make"></a>
554
554
 
@@ -1246,6 +1246,7 @@
1246
1246
  * @param {TreeLinker} [settings.prev=null] The reference to the previous linker if any
1247
1247
  * @param {LinkedTreeList} [settings.children=null] The references to child linkers if any
1248
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
1249
1250
  */
1250
1251
  constructor () {
1251
1252
  const {
@@ -1253,7 +1254,8 @@
1253
1254
  next = null,
1254
1255
  prev = null,
1255
1256
  children = null,
1256
- parent = null
1257
+ parent = null,
1258
+ listClass = _LinkedTreeList.default
1257
1259
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
1258
1260
  this.classType = TreeLinker
1259
1261
  this.data = null
@@ -1265,27 +1267,25 @@
1265
1267
  this.next = next
1266
1268
  this.prev = prev
1267
1269
  this.parent = parent
1268
- this.children = this.childrenFromArray(children)
1270
+ this.children = this.childrenFromArray(children, listClass)
1269
1271
  }
1270
1272
 
1271
1273
  /**
1272
1274
  * Create the children for this tree from an array.
1273
1275
  * @param {Array|null} children Provide an array of data / linker references to be children of this tree node.
1274
- * @param {IsTree} classType Provide the type of IsElement to use.
1275
- * @param {IsArrayable<IsTree>} listType Give the type of list to use for storing the children
1276
+ * @param {IsArrayable<IsTreeNode>} listClass Give the type of list to use for storing the children
1276
1277
  * @return {LinkedTreeList|null}
1277
1278
  */
1278
1279
  childrenFromArray () {
1279
1280
  const children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
1280
- const classType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TreeLinker
1281
- const listType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _LinkedTreeList.default
1281
+ const listClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _LinkedTreeList.default
1282
1282
  if (children === null) {
1283
1283
  return null
1284
1284
  }
1285
1285
  // Creates a linked-tree-list to store the children.
1286
- return listType.fromArray(children.map(child => Object.assign({}, child, {
1286
+ return listClass.fromArray(children.map(child => Object.assign({}, child, {
1287
1287
  parent: this
1288
- })), classType)
1288
+ })), this.classType)
1289
1289
  }
1290
1290
  }
1291
1291
  /**