collect-your-stuff 1.1.2 → 1.1.3

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
@@ -517,7 +517,7 @@ TreeLinker represents a node in a LinkedTreeList having a parent (or root) and c
517
517
  * [TreeLinker](#TreeLinker) ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
518
518
  * [new TreeLinker([settings])](#new_TreeLinker_new)
519
519
  * _instance_
520
- * [.childrenFromArray(children, classType)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
520
+ * [.childrenFromArray(children, classType, listType)](#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>
@@ -539,7 +539,7 @@ Create the new TreeLinker instance, provide the data and optionally set referenc
539
539
 
540
540
  <a name="TreeLinker+childrenFromArray"></a>
541
541
 
542
- ### treeLinker.childrenFromArray(children, classType) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
542
+ ### treeLinker.childrenFromArray(children, classType, listType) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
543
543
  Create the children for this tree from an array.
544
544
 
545
545
  **Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
@@ -548,6 +548,7 @@ Create the children for this tree from an array.
548
548
  | --- | --- | --- |
549
549
  | children | <code>Array</code> \| <code>null</code> | Provide an array of data / linker references to be children of this tree node. |
550
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
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.
@@ -1271,16 +1272,18 @@
1271
1272
  * Create the children for this tree from an array.
1272
1273
  * @param {Array|null} children Provide an array of data / linker references to be children of this tree node.
1273
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
1274
1276
  * @return {LinkedTreeList|null}
1275
1277
  */
1276
1278
  childrenFromArray () {
1277
1279
  const children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null
1278
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
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 listType.fromArray(children.map(child => Object.assign({}, child, {
1284
1287
  parent: this
1285
1288
  })), classType)
1286
1289
  }
@@ -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