Comparing version 1.0.2 to 1.1.0
15
index.js
@@ -46,2 +46,17 @@ /* jshint node: true */ | ||
/* | ||
* decrement decrements the current duration | ||
* | ||
* @param {Number|Duration} n | ||
* @api public | ||
*/ | ||
Duration.prototype.decrement = function(n) { | ||
if (n instanceof Duration) { | ||
n = n.t; | ||
} | ||
this.t = this.t - n; | ||
}; | ||
/* | ||
* days returns the *remaining* days | ||
@@ -48,0 +63,0 @@ * |
{ | ||
"name": "dur-js", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Duration object", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,2 +38,20 @@ /* jshint node: true */ | ||
}); | ||
it("decrements the existing duration", function() { | ||
var d = new Duration(15465601000); | ||
d.decrement(1000); | ||
assert.equal(179, d.days()); | ||
assert.equal(0, d.hours()); | ||
assert.equal(0, d.minutes()); | ||
assert.equal(0, d.seconds()); | ||
assert.equal(0, d.milliseconds()); | ||
var e = new Duration(1000); | ||
d.decrement(e); | ||
assert.equal(178, d.days()); | ||
assert.equal(23, d.hours()); | ||
assert.equal(59, d.minutes()); | ||
assert.equal(59, d.seconds()); | ||
assert.equal(0, d.milliseconds()); | ||
}); | ||
}); |
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
5785
188