befly 2.0.3 → 2.0.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/package.json +2 -2
- package/utils/util.js +12 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Buma - 为 Bun 专属打造的 API 接口框架核心引擎",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"README.md",
|
|
52
52
|
"vitest.config.js"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "599e77ab68a5bd46b1be84a6f0914ee4e45402ba"
|
|
55
55
|
}
|
package/utils/util.js
CHANGED
|
@@ -173,23 +173,21 @@ export const dirname2 = (importMetaUrl) => {
|
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
// 过滤日志字段的函数
|
|
176
|
-
export const filterLogFields = (body, excludeFields =
|
|
176
|
+
export const filterLogFields = (body, excludeFields = '') => {
|
|
177
177
|
if (!body || typeof body !== 'object') return body;
|
|
178
178
|
|
|
179
179
|
// 如果是字符串,按逗号分割并清理空格
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (field in filtered) {
|
|
191
|
-
delete filtered[field];
|
|
180
|
+
const fieldsArray = excludeFields
|
|
181
|
+
.split(',')
|
|
182
|
+
.map((field) => field.trim())
|
|
183
|
+
.filter((field) => field.length > 0);
|
|
184
|
+
|
|
185
|
+
// 创建新对象,只包含不在排除列表中的字段
|
|
186
|
+
const filtered = {};
|
|
187
|
+
for (const [key, value] of Object.entries(body)) {
|
|
188
|
+
if (!fieldsArray.includes(key)) {
|
|
189
|
+
filtered[key] = value;
|
|
192
190
|
}
|
|
193
|
-
}
|
|
191
|
+
}
|
|
194
192
|
return filtered;
|
|
195
193
|
};
|