Skip to content

Commit 94cf9f0

Browse files
committed
Optimization
1 parent 7c62224 commit 94cf9f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/util/src/obj.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ export function map<T extends object, V, U extends { [key in keyof T]: V }>(
4848
opt_obj?: unknown
4949
): U {
5050
const res: Partial<U> = {};
51-
for (const [key, value] of Object.entries(obj)) {
52-
res[key as Keys<T>] = fn.call(opt_obj, value, key, obj);
51+
for (const key in obj) {
52+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
53+
res[key] = fn.call(opt_obj, obj[key], key, obj);
54+
}
5355
}
5456
return res as U;
5557
}

0 commit comments

Comments
 (0)