clear up for..in loop eslint errors

This commit is contained in:
Jeff Nusz 2016-09-01 16:06:25 -07:00
parent f975c09123
commit 9c8b0cf118

View File

@ -25,10 +25,13 @@ const Common = {
extend: function(target) { extend: function(target) {
this.each(ARR_SLICE.call(arguments, 1), function(obj) { this.each(ARR_SLICE.call(arguments, 1), function(obj) {
for (const key in obj) { if (!this.isUndefined(obj)) {
if (!this.isUndefined(obj[key])) { const keys = Object.keys(obj);
target[key] = obj[key]; keys.forEach(function(key) {
} if (!this.isUndefined(obj[key])) {
target[key] = obj[key];
}
}.bind(this));
} }
}, this); }, this);
@ -37,10 +40,13 @@ const Common = {
defaults: function(target) { defaults: function(target) {
this.each(ARR_SLICE.call(arguments, 1), function(obj) { this.each(ARR_SLICE.call(arguments, 1), function(obj) {
for (const key in obj) { if (!this.isUndefined(obj)) {
if (this.isUndefined(target[key])) { const keys = Object.keys(obj);
target[key] = obj[key]; keys.forEach(function(key) {
} if (this.isUndefined(target[key])) {
target[key] = obj[key];
}
}.bind(this));
} }
}, this); }, this);
@ -74,11 +80,14 @@ const Common = {
} }
} }
} else { } else {
for (const key in obj) { if (this.isUndefined(obj)) return;
const keys = Object.keys(obj);
keys.forEach(function(key) {
if (itr.call(scope, obj[key], key) === this.BREAK) { if (itr.call(scope, obj[key], key) === this.BREAK) {
return; return;
} }
} }.bind(this));
} }
}, },