Comparing version 1.0.0 to 2.0.0
17
index.js
@@ -14,11 +14,14 @@ function Rectangle(x, y, width, height) { | ||
Rectangle.prototype.perimeter = function () { | ||
return (this.width * 2) + (this.height * 2); | ||
}; | ||
Object.defineProperty(Rectangle.prototype, 'perimeter', { | ||
get: function () { | ||
return (this.width * 2) + (this.height * 2); | ||
} | ||
}); | ||
Rectangle.prototype.area = function () { | ||
return this.width * this.height; | ||
}; | ||
Object.defineProperty(Rectangle.prototype, 'area', { | ||
get: function () { | ||
return this.width * this.height; | ||
} | ||
}); | ||
module.exports = Rectangle; |
{ | ||
"name": "nectar-leg", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "A fun JavaScript library for working with rectangles.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,9 +55,5 @@ const assert = require('assert'); | ||
it('should have a perimeter method', function () { | ||
assert(Rectangle.prototype.perimeter, 'Prototype does not have a perimeter method.'); | ||
}); | ||
it('should return the perimeter of the rectangle', function () { | ||
var rect = new Rectangle(0, 0, 10, 10); | ||
assert.equal(rect.perimeter(), 40); | ||
assert.equal(rect.perimeter, 40); | ||
}); | ||
@@ -69,9 +65,5 @@ | ||
it('should have a area method', function () { | ||
assert(Rectangle.prototype.area, 'Prototype does not have a area method.'); | ||
}); | ||
it('should return the area of the rectangle', function () { | ||
var rect = new Rectangle(0, 0, 10, 10); | ||
assert.equal(rect.area(), 100); | ||
assert.equal(rect.area, 100); | ||
}); | ||
@@ -78,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3384
13
72