@vope/utils 1.9.2 → 1.9.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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.3] - 2026-11-11
9
+ ### Fixed
10
+ - 修复 [forBfsEach](src/each.ts)、[forBfsAsyncEach](src/each.ts)、[forDfsEach](src/each.ts) 和 [forDfsAsyncEach](src/each.ts) 在嵌套遍历中回调返回 `false` 后未彻底停止的问题
11
+
12
+ ### Changed
13
+ - 完善 [forBfsEach](src/each.ts)、[forBfsAsyncEach](src/each.ts) 和 [forDfsAsyncEach](src/each.ts) 单元测试
14
+
15
+
8
16
  ## [1.9.2] - 2026-09-15
9
17
  ### Added
10
18
  - 添加 [forBfsAsyncEach](src/each.ts) 方法,[forBfsEach](src/each.ts) 异步版本
package/README.md CHANGED
@@ -32,7 +32,11 @@ yarn add @vope/utils
32
32
  |--------|------|
33
33
  | FlatTree | 扁平树 |
34
34
  | forBfsEach | 广度优先搜索 |
35
+ | forBfsAsyncEach | 广度优先异步搜索 |
35
36
  | forDfsEach | 深度优先搜索 |
37
+ | forDfsAsyncEach | 深度优先异步搜索 |
38
+ | forDfsStackEach | 深度优先栈模式搜索(从里到外回调) |
39
+ | forDfsStackAsyncEach | 深度优先栈模式异步搜索(从里到外回调) |
36
40
 
37
41
  ### 数据转换
38
42
 
package/dist/each.js CHANGED
@@ -2,7 +2,7 @@ const forBfsEach = (list, up, callback) => {
2
2
  const stack = [list];
3
3
  for (const list2 of stack) {
4
4
  for (const value of list2) {
5
- if (!callback(value)) break;
5
+ if (!callback(value)) return;
6
6
  const result = up(value);
7
7
  result === void 0 || stack.push(result);
8
8
  }
@@ -12,7 +12,7 @@ const forBfsAsyncEach = async (list, up, callback) => {
12
12
  const stack = [list];
13
13
  for (const list2 of stack) {
14
14
  for (const value of list2) {
15
- if (!await callback(value)) break;
15
+ if (!await callback(value)) return;
16
16
  const result = up(value);
17
17
  result === void 0 || stack.push(result);
18
18
  }
@@ -29,7 +29,7 @@ const forDfsEach = (list, up, callback) => {
29
29
  const stack = reverseMergeIn(list);
30
30
  while (stack.length > 0) {
31
31
  const value = stack.pop();
32
- if (!callback(value)) break;
32
+ if (!callback(value)) return;
33
33
  const result = up(value);
34
34
  result === void 0 || reverseMergeIn(result, stack);
35
35
  }
@@ -38,7 +38,7 @@ const forDfsAsyncEach = async (list, up, callback) => {
38
38
  const stack = reverseMergeIn(list);
39
39
  while (stack.length > 0) {
40
40
  const value = stack.pop();
41
- if (!await callback(value)) break;
41
+ if (!await callback(value)) return;
42
42
  const result = up(value);
43
43
  result === void 0 || reverseMergeIn(result, stack);
44
44
  }
package/dist/index.cjs.js CHANGED
@@ -1187,7 +1187,7 @@ var forBfsEach = (list, up, callback) => {
1187
1187
  const stack = [list];
1188
1188
  for (const list2 of stack) {
1189
1189
  for (const value of list2) {
1190
- if (!callback(value)) break;
1190
+ if (!callback(value)) return;
1191
1191
  const result = up(value);
1192
1192
  result === void 0 || stack.push(result);
1193
1193
  }
@@ -1197,7 +1197,7 @@ var forBfsAsyncEach = async (list, up, callback) => {
1197
1197
  const stack = [list];
1198
1198
  for (const list2 of stack) {
1199
1199
  for (const value of list2) {
1200
- if (!await callback(value)) break;
1200
+ if (!await callback(value)) return;
1201
1201
  const result = up(value);
1202
1202
  result === void 0 || stack.push(result);
1203
1203
  }
@@ -1214,7 +1214,7 @@ var forDfsEach = (list, up, callback) => {
1214
1214
  const stack = reverseMergeIn(list);
1215
1215
  while (stack.length > 0) {
1216
1216
  const value = stack.pop();
1217
- if (!callback(value)) break;
1217
+ if (!callback(value)) return;
1218
1218
  const result = up(value);
1219
1219
  result === void 0 || reverseMergeIn(result, stack);
1220
1220
  }
@@ -1223,7 +1223,7 @@ var forDfsAsyncEach = async (list, up, callback) => {
1223
1223
  const stack = reverseMergeIn(list);
1224
1224
  while (stack.length > 0) {
1225
1225
  const value = stack.pop();
1226
- if (!await callback(value)) break;
1226
+ if (!await callback(value)) return;
1227
1227
  const result = up(value);
1228
1228
  result === void 0 || reverseMergeIn(result, stack);
1229
1229
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vope/utils",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -78,5 +78,10 @@
78
78
  "esbuild",
79
79
  "puppeteer"
80
80
  ]
81
+ },
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "git+https://github.com/702017364/utils.git",
85
+ "directory": "packages/utils"
81
86
  }
82
87
  }