Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dur-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dur-js - npm Package Compare versions

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 @@ *

2

package.json
{
"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());
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc