Socket
Socket
Sign inDemoInstall

@js-joda/extra

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-joda/extra - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

5

CHANGELOG.md

@@ -6,2 +6,7 @@ @js-joda/extra Changelog

### 0.5.0
* Upgrade dependencies #555 by @pithu
* Change @babel/preset-env targets, fix IE11 issues #555 by @pithu
### 0.4.0

@@ -8,0 +13,0 @@

31

dist/js-joda-extra.d.ts

@@ -1,29 +0,12 @@

/// <reference types="@js-joda/core" />
import { Instant, Duration } from '@js-joda/core';
declare namespace JSJodaExtra {
class Interval {
static of(
startInstant: Instant,
endInstantOrDuration: Instant | Duration,
): Interval;
static ofInstantInstant(
startInclusive: Instant,
endExclusive: Instant,
): Interval;
static ofInstantDuration(
startInclusive: Instant,
duration: Duration,
): Interval;
export class Interval {
static of(startInclusive: Instant, endExclusive: Instant): Interval;
static of(startInclusive: Instant, duration: Duration): Interval;
static parse(text: string): Interval;
constructor(startInclusive: Instant, endExclusive: Instant);
private constructor();
start(): Instant;
end(): Instant;
isEmpty(): boolean;

@@ -49,8 +32,8 @@ isUnboundedStart(): boolean;

toDuration(): Duration;
equals(obj: any): boolean;
equals(other: any): boolean;
hashCode(): number;
toString(): string;
}
}
export = JSJodaExtra;
export const __esModule: true;
export as namespace JSJodaExtra;

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

//! @version @js-joda/extra - 0.4.0
//! @version @js-joda/extra - 0.5.0
//! @copyright (c) 2015-2016, Philipp Thürwächter, Pattrick Hüper & js-joda contributors

@@ -118,2 +118,8 @@ //! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos

/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assert */ "./src/assert.js");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*

@@ -127,254 +133,285 @@ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper

var Interval = function () {
Interval.of = function of(startInstant, endInstantOrDuration) {
if (endInstantOrDuration instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"]) {
return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
} else {
return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
}
};
function Interval(startInclusive, endExclusive) {
_classCallCheck(this, Interval);
Interval.ofInstantInstant = function ofInstantInstant(startInclusive, endExclusive) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(endExclusive, 'endExclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(endExclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'endExclusive');
this._start = startInclusive;
this._end = endExclusive;
}
if (endExclusive.isBefore(startInclusive)) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('End instant must on or after start instant');
_createClass(Interval, [{
key: "start",
value: function start() {
return this._start;
}
return new Interval(startInclusive, endExclusive);
};
Interval.ofInstantDuration = function ofInstantDuration(startInclusive, duration) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(duration, 'duration');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(duration, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"], 'duration');
if (duration.isNegative()) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('Duration must not be zero or negative');
}, {
key: "end",
value: function end() {
return this._end;
}
return new Interval(startInclusive, startInclusive.plus(duration));
};
Interval.parse = function parse(text) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(text, 'text');
if (!(typeof text === 'string')) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["IllegalArgumentException"]("text must be a string, but is " + text.constructor.name);
}, {
key: "isEmpty",
value: function isEmpty() {
return this._start.equals(this._end);
}
}, {
key: "isUnboundedStart",
value: function isUnboundedStart() {
return this._start.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN);
}
}, {
key: "isUnboundedEnd",
value: function isUnboundedEnd() {
return this._end.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
}
}, {
key: "withStart",
value: function withStart(start) {
return Interval.of(start, this._end);
}
}, {
key: "withEnd",
value: function withEnd(end) {
return Interval.of(this._start, end);
}
}, {
key: "contains",
value: function contains(instant) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(instant, 'instant');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(instant, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'instant');
return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
}
}, {
key: "encloses",
value: function encloses(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
}
}, {
key: "abuts",
value: function abuts(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return !this._end.equals(other.start()) !== !this._start.equals(other.end());
}
}, {
key: "isConnected",
value: function isConnected(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
}
}, {
key: "overlaps",
value: function overlaps(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
}
}, {
key: "intersection",
value: function intersection(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
for (var i = 0; i < text.length; i += 1) {
if (text.charAt(i) === '/') {
var firstChar = text.charAt(0);
if (this.isConnected(other) === false) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: ".concat(this, " and ").concat(other));
}
if (firstChar === 'P' || firstChar === 'p') {
var duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(0, i));
var end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
return Interval.of(end.minus(duration), end);
} else {
var start = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(0, i)).toInstant();
var cmpStart = this._start.compareTo(other.start());
if (i + 1 < text.length) {
var c = text.charAt(i + 1);
var cmpEnd = this._end.compareTo(other.end());
if (c === 'P' || c === 'p') {
var _duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(i + 1, text.length));
return Interval.of(start, start.plus(_duration));
}
}
var _end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
return Interval.of(start, _end);
}
if (cmpStart >= 0 && cmpEnd <= 0) {
return this;
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return other;
} else {
var newStart = cmpStart >= 0 ? this._start : other.start();
var newEnd = cmpEnd <= 0 ? this._end : other.end();
return Interval.of(newStart, newEnd);
}
}
}, {
key: "union",
value: function union(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeParseException"]('Interval cannot be parsed, no forward slash found', text, 0);
};
if (this.isConnected(other) === false) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: ".concat(this, " and ").concat(other));
}
function Interval(startInclusive, endExclusive) {
this._start = startInclusive;
this._end = endExclusive;
}
var cmpStart = this._start.compareTo(other.start());
var _proto = Interval.prototype;
var cmpEnd = this._end.compareTo(other.end());
_proto.start = function start() {
return this._start;
};
_proto.end = function end() {
return this._end;
};
_proto.isEmpty = function isEmpty() {
return this._start.equals(this._end);
};
_proto.isUnboundedStart = function isUnboundedStart() {
return this._start.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN);
};
_proto.isUnboundedEnd = function isUnboundedEnd() {
return this._end.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
};
_proto.withStart = function withStart(start) {
return Interval.of(start, this._end);
};
_proto.withEnd = function withEnd(end) {
return Interval.of(this._start, end);
};
_proto.contains = function contains(instant) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(instant, 'instant');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(instant, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'instant');
return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
};
_proto.encloses = function encloses(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
};
_proto.abuts = function abuts(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return !this._end.equals(other.start()) !== !this._start.equals(other.end());
};
_proto.isConnected = function isConnected(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
};
_proto.overlaps = function overlaps(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
};
_proto.intersection = function intersection(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
if (this.isConnected(other) === false) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: " + this + " and " + other);
if (cmpStart >= 0 && cmpEnd <= 0) {
return other;
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return this;
} else {
var newStart = cmpStart >= 0 ? other.start() : this._start;
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
return Interval.of(newStart, newEnd);
}
}
}, {
key: "span",
value: function span(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
var cmpStart = this._start.compareTo(other.start());
var cmpStart = this._start.compareTo(other.start());
var cmpEnd = this._end.compareTo(other.end());
var cmpEnd = this._end.compareTo(other.end());
if (cmpStart >= 0 && cmpEnd <= 0) {
return this;
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return other;
} else {
var newStart = cmpStart >= 0 ? this._start : other.start();
var newEnd = cmpEnd <= 0 ? this._end : other.end();
var newStart = cmpStart >= 0 ? other.start() : this._start;
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
return Interval.of(newStart, newEnd);
}
};
}, {
key: "isAfter",
value: function isAfter(instantOrInterval) {
if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
return this.isAfterInstant(instantOrInterval);
} else {
return this.isAfterInterval(instantOrInterval);
}
}
}, {
key: "isBefore",
value: function isBefore(instantOrInterval) {
if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
return this.isBeforeInstant(instantOrInterval);
} else {
return this.isBeforeInterval(instantOrInterval);
}
}
}, {
key: "isAfterInstant",
value: function isAfterInstant(instant) {
return this._start.compareTo(instant) > 0;
}
}, {
key: "isBeforeInstant",
value: function isBeforeInstant(instant) {
return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
}
}, {
key: "isAfterInterval",
value: function isAfterInterval(interval) {
return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
}
}, {
key: "isBeforeInterval",
value: function isBeforeInterval(interval) {
return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
}
}, {
key: "toDuration",
value: function toDuration() {
return _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].between(this._start, this._end);
}
}, {
key: "equals",
value: function equals(obj) {
if (this === obj) {
return true;
}
_proto.union = function union(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
if (obj instanceof Interval) {
return this._start.equals(obj.start()) && this._end.equals(obj.end());
}
if (this.isConnected(other) === false) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: " + this + " and " + other);
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._start.hashCode() ^ this._end.hashCode();
}
}, {
key: "toString",
value: function toString() {
return "".concat(this._start.toString(), "/").concat(this._end.toString());
}
}], [{
key: "of",
value: function of(startInstant, endInstantOrDuration) {
if (endInstantOrDuration instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"]) {
return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
} else {
return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
}
}
}, {
key: "ofInstantInstant",
value: function ofInstantInstant(startInclusive, endExclusive) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(endExclusive, 'endExclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(endExclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'endExclusive');
var cmpStart = this._start.compareTo(other.start());
if (endExclusive.isBefore(startInclusive)) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('End instant must on or after start instant');
}
var cmpEnd = this._end.compareTo(other.end());
if (cmpStart >= 0 && cmpEnd <= 0) {
return other;
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return this;
} else {
var newStart = cmpStart >= 0 ? other.start() : this._start;
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
return Interval.of(newStart, newEnd);
return new Interval(startInclusive, endExclusive);
}
};
}, {
key: "ofInstantDuration",
value: function ofInstantDuration(startInclusive, duration) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(duration, 'duration');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(duration, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"], 'duration');
_proto.span = function span(other) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
if (duration.isNegative()) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('Duration must not be zero or negative');
}
var cmpStart = this._start.compareTo(other.start());
return new Interval(startInclusive, startInclusive.plus(duration));
}
}, {
key: "parse",
value: function parse(text) {
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(text, 'text');
var cmpEnd = this._end.compareTo(other.end());
if (!(typeof text === 'string')) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["IllegalArgumentException"]("text must be a string, but is ".concat(text.constructor.name));
}
var newStart = cmpStart >= 0 ? other.start() : this._start;
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
return Interval.of(newStart, newEnd);
};
for (var i = 0; i < text.length; i += 1) {
if (text.charAt(i) === '/') {
var firstChar = text.charAt(0);
_proto.isAfter = function isAfter(instantOrInterval) {
if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
return this.isAfterInstant(instantOrInterval);
} else {
return this.isAfterInterval(instantOrInterval);
}
};
if (firstChar === 'P' || firstChar === 'p') {
var duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(0, i));
var end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
return Interval.of(end.minus(duration), end);
} else {
var start = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(0, i)).toInstant();
_proto.isBefore = function isBefore(instantOrInterval) {
if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
return this.isBeforeInstant(instantOrInterval);
} else {
return this.isBeforeInterval(instantOrInterval);
}
};
if (i + 1 < text.length) {
var c = text.charAt(i + 1);
_proto.isAfterInstant = function isAfterInstant(instant) {
return this._start.compareTo(instant) > 0;
};
if (c === 'P' || c === 'p') {
var _duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(i + 1, text.length));
_proto.isBeforeInstant = function isBeforeInstant(instant) {
return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
};
return Interval.of(start, start.plus(_duration));
}
}
_proto.isAfterInterval = function isAfterInterval(interval) {
return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
};
var _end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
_proto.isBeforeInterval = function isBeforeInterval(interval) {
return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
};
return Interval.of(start, _end);
}
}
}
_proto.toDuration = function toDuration() {
return _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].between(this._start, this._end);
};
_proto.equals = function equals(obj) {
if (this === obj) {
return true;
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeParseException"]('Interval cannot be parsed, no forward slash found', text, 0);
}
}]);
if (obj instanceof Interval) {
return this._start.equals(obj.start()) && this._end.equals(obj.end());
}
return false;
};
_proto.hashCode = function hashCode() {
return this._start.hashCode() ^ this._end.hashCode();
};
_proto.toString = function toString() {
return this._start.toString() + "/" + this._end.toString();
};
return Interval;

@@ -449,3 +486,3 @@ }();

if (value == null) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["NullPointerException"](parameterName + " must not be null");
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["NullPointerException"]("".concat(parameterName, " must not be null"));
}

@@ -457,3 +494,3 @@

if (!(value instanceof _class)) {
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["IllegalArgumentException"](parameterName + " must be an instance of " + (_class.name ? _class.name : _class) + (value && value.constructor && value.constructor.name ? ", but is " + value.constructor.name : ''));
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["IllegalArgumentException"]("".concat(parameterName, " must be an instance of ").concat(_class.name ? _class.name : _class).concat(value && value.constructor && value.constructor.name ? ", but is ".concat(value.constructor.name) : ''));
}

@@ -464,3 +501,3 @@

function abstractMethodFail(methodName) {
throw new TypeError("abstract method \"" + methodName + "\" is not implemented");
throw new TypeError("abstract method \"".concat(methodName, "\" is not implemented"));
}

@@ -467,0 +504,0 @@

@@ -1,5 +0,5 @@

//! @version @js-joda/extra - 0.4.0
//! @version @js-joda/extra - 0.5.0
//! @copyright (c) 2015-2016, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
//! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
//! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@js-joda/core")):"function"==typeof define&&define.amd?define(["@js-joda/core"],n):"object"==typeof exports?exports.JSJodaExtra=n(require("@js-joda/core")):t.JSJodaExtra=n(t.JSJoda)}(this,function(e){return s={},o.m=r=[function(t,n){t.exports=e},function(t,n,e){"use strict";e.r(n);var f=e(0);function h(t,n){if(null==t)throw new f.NullPointerException(n+" must not be null");return t}function s(t,n,e){if(!(t instanceof n))throw new f.IllegalArgumentException(e+" must be an instance of "+(n.name?n.name:n)+(t&&t.constructor&&t.constructor.name?", but is "+t.constructor.name:""));return t}var r=function(){function c(t,n){this._start=t,this._end=n}c.of=function(t,n){return n instanceof f.Duration?c.ofInstantDuration(t,n):c.ofInstantInstant(t,n)},c.ofInstantInstant=function(t,n){if(h(t,"startInclusive"),h(n,"endExclusive"),s(t,f.Instant,"startInclusive"),s(n,f.Instant,"endExclusive"),n.isBefore(t))throw new f.DateTimeException("End instant must on or after start instant");return new c(t,n)},c.ofInstantDuration=function(t,n){if(h(t,"startInclusive"),h(n,"duration"),s(t,f.Instant,"startInclusive"),s(n,f.Duration,"duration"),n.isNegative())throw new f.DateTimeException("Duration must not be zero or negative");return new c(t,t.plus(n))},c.parse=function(t){if(h(t,"text"),"string"!=typeof t)throw new f.IllegalArgumentException("text must be a string, but is "+t.constructor.name);for(var n=0;n<t.length;n+=1)if("/"===t.charAt(n)){var e=t.charAt(0);if("P"===e||"p"===e){var r=f.Duration.parse(t.substring(0,n)),o=f.ZonedDateTime.parse(t.substring(n+1,t.length)).toInstant();return c.of(o.minus(r),o)}var s=f.ZonedDateTime.parse(t.substring(0,n)).toInstant();if(n+1<t.length){var i=t.charAt(n+1);if("P"===i||"p"===i){var a=f.Duration.parse(t.substring(n+1,t.length));return c.of(s,s.plus(a))}}var u=f.ZonedDateTime.parse(t.substring(n+1,t.length)).toInstant();return c.of(s,u)}throw new f.DateTimeParseException("Interval cannot be parsed, no forward slash found",t,0)};var t=c.prototype;return t.start=function(){return this._start},t.end=function(){return this._end},t.isEmpty=function(){return this._start.equals(this._end)},t.isUnboundedStart=function(){return this._start.equals(f.Instant.MIN)},t.isUnboundedEnd=function(){return this._end.equals(f.Instant.MAX)},t.withStart=function(t){return c.of(t,this._end)},t.withEnd=function(t){return c.of(this._start,t)},t.contains=function(t){return h(t,"instant"),s(t,f.Instant,"instant"),this._start.compareTo(t)<=0&&(t.compareTo(this._end)<0||this.isUnboundedEnd())},t.encloses=function(t){return h(t,"other"),s(t,c,"other"),this._start.compareTo(t.start())<=0&&t.end().compareTo(this._end)<=0},t.abuts=function(t){return h(t,"other"),s(t,c,"other"),!this._end.equals(t.start())!=!this._start.equals(t.end())},t.isConnected=function(t){return h(t,"other"),s(t,c,"other"),this.equals(t)||this._start.compareTo(t.end())<=0&&t.start().compareTo(this._end)<=0},t.overlaps=function(t){return h(t,"other"),s(t,c,"other"),t.equals(this)||this._start.compareTo(t.end())<0&&t.start().compareTo(this._end)<0},t.intersection=function(t){if(h(t,"other"),s(t,c,"other"),!1===this.isConnected(t))throw new f.DateTimeException("Intervals do not connect: "+this+" and "+t);var n=this._start.compareTo(t.start()),e=this._end.compareTo(t.end());if(0<=n&&e<=0)return this;if(n<=0&&0<=e)return t;var r=0<=n?this._start:t.start(),o=e<=0?this._end:t.end();return c.of(r,o)},t.union=function(t){if(h(t,"other"),s(t,c,"other"),!1===this.isConnected(t))throw new f.DateTimeException("Intervals do not connect: "+this+" and "+t);var n=this._start.compareTo(t.start()),e=this._end.compareTo(t.end());if(0<=n&&e<=0)return t;if(n<=0&&0<=e)return this;var r=0<=n?t.start():this._start,o=e<=0?t.end():this._end;return c.of(r,o)},t.span=function(t){h(t,"other"),s(t,c,"other");var n=this._start.compareTo(t.start()),e=this._end.compareTo(t.end()),r=0<=n?t.start():this._start,o=e<=0?t.end():this._end;return c.of(r,o)},t.isAfter=function(t){return t instanceof f.Instant?this.isAfterInstant(t):this.isAfterInterval(t)},t.isBefore=function(t){return t instanceof f.Instant?this.isBeforeInstant(t):this.isBeforeInterval(t)},t.isAfterInstant=function(t){return 0<this._start.compareTo(t)},t.isBeforeInstant=function(t){return this._end.compareTo(t)<=0&&this._start.compareTo(t)<0},t.isAfterInterval=function(t){return 0<=this._start.compareTo(t.end())&&!t.equals(this)},t.isBeforeInterval=function(t){return this._end.compareTo(t.start())<=0&&!t.equals(this)},t.toDuration=function(){return f.Duration.between(this._start,this._end)},t.equals=function(t){return this===t||t instanceof c&&(this._start.equals(t.start())&&this._end.equals(t.end()))},t.hashCode=function(){return this._start.hashCode()^this._end.hashCode()},t.toString=function(){return this._start.toString()+"/"+this._end.toString()},c}();var o=!1;o||(o=!0,r.ALL=r.of(f.Instant.MIN,f.Instant.MAX));e.d(n,"Interval",function(){return r}),Object(f.use)(function(){})}],o.c=s,o.d=function(t,n,e){o.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(n,t){if(1&t&&(n=o(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var r in n)o.d(e,r,function(t){return n[t]}.bind(null,r));return e},o.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(n,"a",n),n},o.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},o.p="",o(o.s=1);function o(t){if(s[t])return s[t].exports;var n=s[t]={i:t,l:!1,exports:{}};return r[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}var r,s});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@js-joda/core")):"function"==typeof define&&define.amd?define(["@js-joda/core"],e):"object"==typeof exports?exports.JSJodaExtra=e(require("@js-joda/core")):t.JSJodaExtra=e(t.JSJoda)}(this,function(n){return a={},o.m=r=[function(t,e){t.exports=n},function(t,e,n){"use strict";n.r(e);var c=n(0);function f(t,e){if(null==t)throw new c.NullPointerException("".concat(e," must not be null"));return t}function a(t,e,n){if(!(t instanceof e))throw new c.IllegalArgumentException("".concat(n," must be an instance of ").concat(e.name?e.name:e).concat(t&&t.constructor&&t.constructor.name?", but is ".concat(t.constructor.name):""));return t}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o,s,i,u=(o=l,i=[{key:"of",value:function(t,e){return e instanceof c.Duration?l.ofInstantDuration(t,e):l.ofInstantInstant(t,e)}},{key:"ofInstantInstant",value:function(t,e){if(f(t,"startInclusive"),f(e,"endExclusive"),a(t,c.Instant,"startInclusive"),a(e,c.Instant,"endExclusive"),e.isBefore(t))throw new c.DateTimeException("End instant must on or after start instant");return new l(t,e)}},{key:"ofInstantDuration",value:function(t,e){if(f(t,"startInclusive"),f(e,"duration"),a(t,c.Instant,"startInclusive"),a(e,c.Duration,"duration"),e.isNegative())throw new c.DateTimeException("Duration must not be zero or negative");return new l(t,t.plus(e))}},{key:"parse",value:function(t){if(f(t,"text"),"string"!=typeof t)throw new c.IllegalArgumentException("text must be a string, but is ".concat(t.constructor.name));for(var e=0;e<t.length;e+=1)if("/"===t.charAt(e)){var n=t.charAt(0);if("P"===n||"p"===n){var r=c.Duration.parse(t.substring(0,e)),o=c.ZonedDateTime.parse(t.substring(e+1,t.length)).toInstant();return l.of(o.minus(r),o)}var a=c.ZonedDateTime.parse(t.substring(0,e)).toInstant();if(e+1<t.length){var s=t.charAt(e+1);if("P"===s||"p"===s){var i=c.Duration.parse(t.substring(e+1,t.length));return l.of(a,a.plus(i))}}var u=c.ZonedDateTime.parse(t.substring(e+1,t.length)).toInstant();return l.of(a,u)}throw new c.DateTimeParseException("Interval cannot be parsed, no forward slash found",t,0)}}],(s=[{key:"start",value:function(){return this._start}},{key:"end",value:function(){return this._end}},{key:"isEmpty",value:function(){return this._start.equals(this._end)}},{key:"isUnboundedStart",value:function(){return this._start.equals(c.Instant.MIN)}},{key:"isUnboundedEnd",value:function(){return this._end.equals(c.Instant.MAX)}},{key:"withStart",value:function(t){return l.of(t,this._end)}},{key:"withEnd",value:function(t){return l.of(this._start,t)}},{key:"contains",value:function(t){return f(t,"instant"),a(t,c.Instant,"instant"),this._start.compareTo(t)<=0&&(t.compareTo(this._end)<0||this.isUnboundedEnd())}},{key:"encloses",value:function(t){return f(t,"other"),a(t,l,"other"),this._start.compareTo(t.start())<=0&&t.end().compareTo(this._end)<=0}},{key:"abuts",value:function(t){return f(t,"other"),a(t,l,"other"),!this._end.equals(t.start())!=!this._start.equals(t.end())}},{key:"isConnected",value:function(t){return f(t,"other"),a(t,l,"other"),this.equals(t)||this._start.compareTo(t.end())<=0&&t.start().compareTo(this._end)<=0}},{key:"overlaps",value:function(t){return f(t,"other"),a(t,l,"other"),t.equals(this)||this._start.compareTo(t.end())<0&&t.start().compareTo(this._end)<0}},{key:"intersection",value:function(t){if(f(t,"other"),a(t,l,"other"),!1===this.isConnected(t))throw new c.DateTimeException("Intervals do not connect: ".concat(this," and ").concat(t));var e=this._start.compareTo(t.start()),n=this._end.compareTo(t.end());if(0<=e&&n<=0)return this;if(e<=0&&0<=n)return t;var r=0<=e?this._start:t.start(),o=n<=0?this._end:t.end();return l.of(r,o)}},{key:"union",value:function(t){if(f(t,"other"),a(t,l,"other"),!1===this.isConnected(t))throw new c.DateTimeException("Intervals do not connect: ".concat(this," and ").concat(t));var e=this._start.compareTo(t.start()),n=this._end.compareTo(t.end());if(0<=e&&n<=0)return t;if(e<=0&&0<=n)return this;var r=0<=e?t.start():this._start,o=n<=0?t.end():this._end;return l.of(r,o)}},{key:"span",value:function(t){f(t,"other"),a(t,l,"other");var e=this._start.compareTo(t.start()),n=this._end.compareTo(t.end()),r=0<=e?t.start():this._start,o=n<=0?t.end():this._end;return l.of(r,o)}},{key:"isAfter",value:function(t){return t instanceof c.Instant?this.isAfterInstant(t):this.isAfterInterval(t)}},{key:"isBefore",value:function(t){return t instanceof c.Instant?this.isBeforeInstant(t):this.isBeforeInterval(t)}},{key:"isAfterInstant",value:function(t){return 0<this._start.compareTo(t)}},{key:"isBeforeInstant",value:function(t){return this._end.compareTo(t)<=0&&this._start.compareTo(t)<0}},{key:"isAfterInterval",value:function(t){return 0<=this._start.compareTo(t.end())&&!t.equals(this)}},{key:"isBeforeInterval",value:function(t){return this._end.compareTo(t.start())<=0&&!t.equals(this)}},{key:"toDuration",value:function(){return c.Duration.between(this._start,this._end)}},{key:"equals",value:function(t){return this===t||t instanceof l&&this._start.equals(t.start())&&this._end.equals(t.end())}},{key:"hashCode",value:function(){return this._start.hashCode()^this._end.hashCode()}},{key:"toString",value:function(){return"".concat(this._start.toString(),"/").concat(this._end.toString())}}])&&r(o.prototype,s),void(i&&r(o,i)),l);function l(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),this._start=t,this._end=e}var h=!1;h||(h=!0,u.ALL=u.of(c.Instant.MIN,c.Instant.MAX));n.d(e,"Interval",function(){return u}),Object(c.use)(function(){})}],o.c=a,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=1);function o(t){if(a[t])return a[t].exports;var e=a[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var r,a});
{
"name": "@js-joda/extra",
"version": "0.4.0",
"version": "0.5.0",
"description": "additional date-time classes that complement those in js-joda",

@@ -12,13 +12,12 @@ "repository": {

"scripts": {
"prepublish": "npm run build-dist",
"postversion": "npm run build-dist",
"test": "./node_modules/.bin/mocha --timeout 5000 --require @babel/register ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js test/pluginTest_mochaOnly.js",
"test-coverage": "NODE_ENV=test COVERAGE=1 ../../node_modules/.bin/nyc --report-dir=build/coverage --reporter=lcov --reporter html ./node_modules/.bin/mocha --timeout 5000 --require @babel/register --reporter progress ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
"test-browser": "./node_modules/.bin/karma start --reporters=dots --single-run",
"test-saucelabs": "./node_modules/.bin/karma start --reporters=\"dots,saucelabs\" --browsers=\"sl_chrome,sl_ie,sl_firefox\" --single-run=true",
"version": "npm run build-dist",
"test": "npx mocha --timeout 5000 --require @babel/register ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js test/pluginTest_mochaOnly.js",
"test-coverage": "NODE_ENV=test COVERAGE=1 npx nyc --report-dir=build/coverage --reporter=lcov --reporter html npx mocha --timeout 5000 --require @babel/register --reporter progress ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
"test-browser": "npx karma start --reporters=dots --single-run",
"test-saucelabs": "npx karma start --reporters=\"dots,saucelabs\" --browsers=\"sl_chrome,sl_ie,sl_firefox\" --single-run=true",
"test-ci": "npm run build-dist && npm run test && npm run test-browser && npm run test-coverage && npm run test-ts-definitions",
"test-ts-definitions": "tsc --noImplicitAny --strict --noEmit --pretty --lib ES6 test/typescript_definitions/js-joda-extra-tests.ts",
"build-dist-es5": "./node_modules/.bin/babel src -d build/es5",
"build-dist": "./node_modules/.bin/webpack --progress --colors --bail && DIST_MIN=1 ./node_modules/.bin/webpack --progress --colors --bail",
"lint": "../../node_modules/.bin/eslint ."
"build-dist-es5": "npx babel src -d build/es5",
"build-dist": "npx webpack --progress --colors --bail && DIST_MIN=1 npx webpack --progress --colors --bail",
"lint": "npx eslint ."
},

@@ -41,30 +40,8 @@ "keywords": [

"peerDependencies": {
"@js-joda/core": "^1.11.0"
"@js-joda/core": ">=1.11.0"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/register": "^7.0.0",
"@js-joda/core": "^1.11.0",
"babel-loader": "^8.0.5",
"babel-plugin-istanbul": "^5.1.1",
"chai": "^4.2.0",
"coveralls": "^3.0.3",
"karma": "^4.0.1",
"karma-chai-plugins": "^0.9.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.1.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sauce-launcher": "^2.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"mocha": "^6.0.2",
"phantomjs-prebuilt": "^2.1.16",
"typescript": "^3.5.3",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
}
"@js-joda/core": "^4.2.0"
},
"gitHead": "cf3ac61c80c0e1f4cc6092022858ce04884ab41a"
}

@@ -9,5 +9,6 @@ # @js-joda/extra

[![Coverage Status](https://coveralls.io/repos/js-joda/js-joda/badge.svg?branch=master&service=github)](https://coveralls.io/github/js-joda/js-joda?branch=master)
[![Tested node version](https://img.shields.io/badge/tested_with-current_node_LTS-blue.svg?style=flat)]()
[![Sauce Test Status](https://saucelabs.com/browser-matrix/js-joda.svg)](https://saucelabs.com/u/js-joda)
[![Downloads/Month](https://img.shields.io/npm/dm/%40js-joda%2Fextra.svg)](https://img.shields.io/npm/dm/%40js-joda%2Fextra.svg)
[![Sauce Browser Matrix](https://saucelabs.com/browser-matrix/js-joda.svg?branch=master)](https://saucelabs.com/u/js-joda)
Attempt to port https://github.com/ThreeTen/threeten-extra to https://github.com/js-joda/js-joda as a js-joda plugin.

@@ -14,0 +15,0 @@

@@ -7,2 +7,9 @@ /**

/**
* @private
*
* @param assertion
* @param msg
* @param error
*/
export function assert(assertion, msg, error) {

@@ -19,2 +26,9 @@ if (!assertion) {

/**
* @private
*
* @param value
* @param parameterName
* @returns {*}
*/
export function requireNonNull(value, parameterName) {

@@ -27,2 +41,10 @@ if (value == null) {

/**
* @private
*
* @param value
* @param _class
* @param parameterName
* @returns {_class}
*/
export function requireInstance(value, _class, parameterName) {

@@ -35,4 +57,9 @@ if (!(value instanceof _class)) {

/**
* @private
*
* @param methodName
*/
export function abstractMethodFail(methodName) {
throw new TypeError(`abstract method "${methodName}" is not implemented`);
}

@@ -11,5 +11,5 @@ /*

/**
* @private
*
* plugin Function, call using js-jodas use()
*
* @param jsJoda
*/

@@ -16,0 +16,0 @@ export default function (/* jsJoda */) {

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