a2bei4-utils 1.0.5 → 1.0.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.
@@ -1228,6 +1228,9 @@ registerProcessor('audio-stream-resampler-processor', AudioStreamResamplerProces
1228
1228
  const urlPathname = new URL(url).pathname;
1229
1229
  // 获取路径的最后一部分作为文件名,并移除可能的查询参数
1230
1230
  fileName = urlPathname.substring(urlPathname.lastIndexOf("/") + 1).split("?")[0];
1231
+ if (fileName) {
1232
+ fileName = decodeURIComponent(fileName);
1233
+ }
1231
1234
  } catch (e) {}
1232
1235
  // 如果提取后文件名为空(例如 URL 以 '/' 结尾),也使用时间戳
1233
1236
  if (!fileName) {
@@ -1798,23 +1801,23 @@ registerProcessor('audio-stream-resampler-processor', AudioStreamResamplerProces
1798
1801
  * @param {T[]} arr - 嵌套树森林
1799
1802
  * @param {string} [idKey='id'] - 主键字段
1800
1803
  * @param {string} [childrenKey='children'] - 子节点字段
1801
- * @returns {any} 找到的节点;未找到返回 `undefined`
1804
+ * @returns {T | undefined} 找到的节点;未找到返回 `undefined`
1802
1805
  */
1803
- const findTreeNodeById = function findTreeNodeByIdFn(id, arr, idKey = "id", childrenKey = "children") {
1806
+ function findTreeNodeById(id, arr, idKey = "id", childrenKey = "children") {
1804
1807
  if (Array.isArray(arr) && arr.length > 0) {
1805
1808
  for (let i = 0; i < arr.length; i++) {
1806
1809
  const item = arr[i];
1807
1810
  if (item[idKey]?.toString() === id?.toString()) {
1808
1811
  return item;
1809
1812
  } else if (Array.isArray(item[childrenKey]) && item[childrenKey].length > 0) {
1810
- const result = findTreeNodeByIdFn(id, item[childrenKey], idKey, childrenKey);
1813
+ const result = findTreeNodeById(id, item[childrenKey], idKey, childrenKey);
1811
1814
  if (result) {
1812
1815
  return result;
1813
1816
  }
1814
1817
  }
1815
1818
  }
1816
1819
  }
1817
- };
1820
+ }
1818
1821
 
1819
1822
  /**
1820
1823
  * 在嵌套树中按 `id` 递归查找节点,并返回其指定属性值。