Skip to content

Commit

Permalink
Move data validation to the setters
Browse files Browse the repository at this point in the history
  • Loading branch information
tusbar committed Aug 1, 2015
1 parent 533334e commit 9132e78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/millipede.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var PADDING = [
function Millipede(size, options) {
options = options || {};

this.size = size || 20;
this.reverse = options.reverse || false;
this.size = size;
this.reverse = options.reverse;
this.horizontal = options.horizontal || false;
this.position = options.position || 0;

Expand All @@ -49,7 +49,7 @@ Object.defineProperty(Millipede.prototype, 'size', {
return this._size;
},
set: function (value) {
this._size = value;
this._size = value || 20;
this._computePadding();
}
});
Expand Down

0 comments on commit 9132e78

Please sign in to comment.