Skip to content

Commit cc753ef

Browse files
authored
Use Object.prototype.hasOwnProperty in copyObj
FIX: Fix an issue where the code assumes input objects have their own `hasOwnProperty` method.
1 parent 78555dd commit cc753ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/misc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function bind(f) {
66
export function copyObj(obj, target, overwrite) {
77
if (!target) target = {}
88
for (let prop in obj)
9-
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
9+
if (Object.prototype.hasOwnProperty.call(obj, prop) && (overwrite !== false || !Object.prototype.hasOwnProperty.call(target, prop)))
1010
target[prop] = obj[prop]
1111
return target
1212
}

0 commit comments

Comments
 (0)