diff --git a/src/shadow.class.js b/src/shadow.class.js index 6a2b4c08..2a1c8ffd 100644 --- a/src/shadow.class.js +++ b/src/shadow.class.js @@ -151,21 +151,13 @@ }; } var obj = { }, proto = fabric.Shadow.prototype; - if (this.color !== proto.color) { - obj.color = this.color; - } - if (this.blur !== proto.blur) { - obj.blur = this.blur; - } - if (this.offsetX !== proto.offsetX) { - obj.offsetX = this.offsetX; - } - if (this.offsetY !== proto.offsetY) { - obj.offsetY = this.offsetY; - } - if (this.affectStroke !== proto.affectStroke) { - obj.affectStroke = this.affectStroke; - } + + ['color', 'blur', 'offsetX', 'offsetY', 'affectStroke'].forEach(function(prop) { + if (this[prop] !== proto[prop]) { + obj[prop] = this[prop]; + } + }, this); + return obj; } });