a2bei4-utils 1.0.5 → 1.0.6

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.
@@ -1798,23 +1798,23 @@ registerProcessor('audio-stream-resampler-processor', AudioStreamResamplerProces
1798
1798
  * @param {T[]} arr - 嵌套树森林
1799
1799
  * @param {string} [idKey='id'] - 主键字段
1800
1800
  * @param {string} [childrenKey='children'] - 子节点字段
1801
- * @returns {any} 找到的节点;未找到返回 `undefined`
1801
+ * @returns {T | undefined} 找到的节点;未找到返回 `undefined`
1802
1802
  */
1803
- const findTreeNodeById = function findTreeNodeByIdFn(id, arr, idKey = "id", childrenKey = "children") {
1803
+ function findTreeNodeById(id, arr, idKey = "id", childrenKey = "children") {
1804
1804
  if (Array.isArray(arr) && arr.length > 0) {
1805
1805
  for (let i = 0; i < arr.length; i++) {
1806
1806
  const item = arr[i];
1807
1807
  if (item[idKey]?.toString() === id?.toString()) {
1808
1808
  return item;
1809
1809
  } else if (Array.isArray(item[childrenKey]) && item[childrenKey].length > 0) {
1810
- const result = findTreeNodeByIdFn(id, item[childrenKey], idKey, childrenKey);
1810
+ const result = findTreeNodeById(id, item[childrenKey], idKey, childrenKey);
1811
1811
  if (result) {
1812
1812
  return result;
1813
1813
  }
1814
1814
  }
1815
1815
  }
1816
1816
  }
1817
- };
1817
+ }
1818
1818
 
1819
1819
  /**
1820
1820
  * 在嵌套树中按 `id` 递归查找节点,并返回其指定属性值。