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

chronoshift

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chronoshift - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

7

build/chronoshift.d.ts

@@ -1,2 +0,1 @@

/// <reference path="../typings/immutable-class.d.ts" />
declare module Chronoshift {

@@ -77,4 +76,4 @@ interface WallTime {

class Duration implements Instance<DurationValue, string> {
private singleSpan;
private spans;
singleSpan: string;
spans: DurationValue;
static fromJS(durationStr: string): Duration;

@@ -101,2 +100,4 @@ static fromCanonicalLength(length: number): Duration;

getDescription(capitalize?: boolean): string;
getSingleSpan(): string;
getSingleSpanValue(): number;
}

@@ -103,0 +104,0 @@ }

@@ -1,2 +0,1 @@

"use strict";
var Chronoshift;

@@ -569,2 +568,10 @@ (function (Chronoshift) {

};
Duration.prototype.getSingleSpan = function () {
return this.singleSpan || null;
};
Duration.prototype.getSingleSpanValue = function () {
if (!this.singleSpan)
return null;
return this.spans[this.singleSpan];
};
return Duration;

@@ -571,0 +578,0 @@ }());

{
"name": "chronoshift",
"version": "0.4.4",
"version": "0.4.5",
"description": "A tiny library for shifting time with timezones",

@@ -5,0 +5,0 @@ "keywords": [

@@ -104,4 +104,4 @@ module Chronoshift {

export class Duration implements Instance<DurationValue, string> {
private singleSpan: string;
private spans: DurationValue;
public singleSpan: string;
public spans: DurationValue;

@@ -320,4 +320,14 @@ static fromJS(durationStr: string): Duration {

}
public getSingleSpan(): string {
return this.singleSpan || null;
}
public getSingleSpanValue(): number {
if (!this.singleSpan) return null;
return this.spans[this.singleSpan];
}
}
check = Duration;
}

@@ -1,4 +0,1 @@

/// <reference path="../typings/immutable-class.d.ts" />
"use strict";
declare function require(file: string): any;

@@ -5,0 +2,0 @@ declare var module: { exports: any; };

@@ -255,2 +255,36 @@ /// <reference path="../typings/mocha/mocha.d.ts" />

});
describe("#getSingleSpan()", function () {
it("gives back the correct span", function () {
var durationStr;
durationStr = "P1D";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('day');
durationStr = "P3Y";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('year');
durationStr = "P2W";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('week');
durationStr = "PT5H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('hour');
durationStr = "P3DT15H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal(null);
durationStr = "P3DT15H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal(null);
});
});
describe("#getSingleSpanValue()", function () {
it("gives back the correct span value", function () {
var durationStr;
durationStr = "P1D";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(1);
durationStr = "P3Y";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(3);
durationStr = "P2W";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(2);
durationStr = "PT5H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(5);
durationStr = "P3DT15H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(null);
durationStr = "P3DT15H";
chai_1.expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(null);
});
});
});

@@ -345,2 +345,49 @@ /// <reference path="../typings/mocha/mocha.d.ts" />

});
describe("#getSingleSpan()", () => {
it("gives back the correct span", () => {
var durationStr;
durationStr = "P1D";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('day');
durationStr = "P3Y";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('year');
durationStr = "P2W";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('week');
durationStr = "PT5H";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal('hour');
durationStr = "P3DT15H";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal(null);
durationStr = "P3DT15H";
expect(Duration.fromJS(durationStr).getSingleSpan()).to.equal(null);
});
});
describe("#getSingleSpanValue()", () => {
it("gives back the correct span value", () => {
var durationStr;
durationStr = "P1D";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(1);
durationStr = "P3Y";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(3);
durationStr = "P2W";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(2);
durationStr = "PT5H";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(5);
durationStr = "P3DT15H";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(null);
durationStr = "P3DT15H";
expect(Duration.fromJS(durationStr).getSingleSpanValue()).to.equal(null);
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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