use hasOwnProperty for safe for in loop on defaults

This commit is contained in:
Andrew Joslin
2015-03-25 08:51:13 -06:00
parent 510f57a041
commit 6fb0743f7b

View File

@ -20,7 +20,7 @@ export function defaults(dest) {
for (let i = arguments.length - 1; i >= 1; i--) {
let source = arguments[i] || {};
for (let key in source) {
if (!dest.hasOwnProperty(key)) {
if (source.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {
dest[key] = source[key];
}
}