@js-joda/extra 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,560 +1,329 @@
1
- //! @version @js-joda/extra - 0.6.0
2
- //! @copyright (c) 2015-2016, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
1
+ //! @version @js-joda/extra - 0.8.0
2
+ //! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
3
3
  //! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
4
  //! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
 
6
- (function webpackUniversalModuleDefinition(root, factory) {
7
- if(typeof exports === 'object' && typeof module === 'object')
8
- module.exports = factory(require("@js-joda/core"));
9
- else if(typeof define === 'function' && define.amd)
10
- define(["@js-joda/core"], factory);
11
- else if(typeof exports === 'object')
12
- exports["JSJodaExtra"] = factory(require("@js-joda/core"));
13
- else
14
- root["JSJodaExtra"] = factory(root["JSJoda"]);
15
- })(this, function(__WEBPACK_EXTERNAL_MODULE__js_joda_core__) {
16
- return /******/ (function(modules) { // webpackBootstrap
17
- /******/ // The module cache
18
- /******/ var installedModules = {};
19
- /******/
20
- /******/ // The require function
21
- /******/ function __webpack_require__(moduleId) {
22
- /******/
23
- /******/ // Check if module is in cache
24
- /******/ if(installedModules[moduleId]) {
25
- /******/ return installedModules[moduleId].exports;
26
- /******/ }
27
- /******/ // Create a new module (and put it into the cache)
28
- /******/ var module = installedModules[moduleId] = {
29
- /******/ i: moduleId,
30
- /******/ l: false,
31
- /******/ exports: {}
32
- /******/ };
33
- /******/
34
- /******/ // Execute the module function
35
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
36
- /******/
37
- /******/ // Flag the module as loaded
38
- /******/ module.l = true;
39
- /******/
40
- /******/ // Return the exports of the module
41
- /******/ return module.exports;
42
- /******/ }
43
- /******/
44
- /******/
45
- /******/ // expose the modules object (__webpack_modules__)
46
- /******/ __webpack_require__.m = modules;
47
- /******/
48
- /******/ // expose the module cache
49
- /******/ __webpack_require__.c = installedModules;
50
- /******/
51
- /******/ // define getter function for harmony exports
52
- /******/ __webpack_require__.d = function(exports, name, getter) {
53
- /******/ if(!__webpack_require__.o(exports, name)) {
54
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
55
- /******/ }
56
- /******/ };
57
- /******/
58
- /******/ // define __esModule on exports
59
- /******/ __webpack_require__.r = function(exports) {
60
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
61
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
62
- /******/ }
63
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
64
- /******/ };
65
- /******/
66
- /******/ // create a fake namespace object
67
- /******/ // mode & 1: value is a module id, require it
68
- /******/ // mode & 2: merge all properties of value into the ns
69
- /******/ // mode & 4: return value when already ns object
70
- /******/ // mode & 8|1: behave like require
71
- /******/ __webpack_require__.t = function(value, mode) {
72
- /******/ if(mode & 1) value = __webpack_require__(value);
73
- /******/ if(mode & 8) return value;
74
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
75
- /******/ var ns = Object.create(null);
76
- /******/ __webpack_require__.r(ns);
77
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
78
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
79
- /******/ return ns;
80
- /******/ };
81
- /******/
82
- /******/ // getDefaultExport function for compatibility with non-harmony modules
83
- /******/ __webpack_require__.n = function(module) {
84
- /******/ var getter = module && module.__esModule ?
85
- /******/ function getDefault() { return module['default']; } :
86
- /******/ function getModuleExports() { return module; };
87
- /******/ __webpack_require__.d(getter, 'a', getter);
88
- /******/ return getter;
89
- /******/ };
90
- /******/
91
- /******/ // Object.prototype.hasOwnProperty.call
92
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
93
- /******/
94
- /******/ // __webpack_public_path__
95
- /******/ __webpack_require__.p = "";
96
- /******/
97
- /******/
98
- /******/ // Load entry module and return exports
99
- /******/ return __webpack_require__(__webpack_require__.s = "./src/js-joda-extra.js");
100
- /******/ })
101
- /************************************************************************/
102
- /******/ ({
103
-
104
- /***/ "./src/Interval.js":
105
- /*!*************************!*\
106
- !*** ./src/Interval.js ***!
107
- \*************************/
108
- /*! exports provided: Interval, _init */
109
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
110
-
111
- "use strict";
112
- __webpack_require__.r(__webpack_exports__);
113
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interval", function() { return Interval; });
114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_init", function() { return _init; });
115
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js-joda/core */ "@js-joda/core");
116
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__);
117
- /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assert */ "./src/assert.js");
118
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
119
-
120
- 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); } }
121
-
122
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
123
-
124
- /*
125
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
126
- * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
127
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
128
- */
129
-
130
-
131
- var Interval = function () {
132
- function Interval(startInclusive, endExclusive) {
133
- _classCallCheck(this, Interval);
134
-
135
- this._start = startInclusive;
136
- this._end = endExclusive;
137
- }
138
-
139
- _createClass(Interval, [{
140
- key: "start",
141
- value: function start() {
142
- return this._start;
143
- }
144
- }, {
145
- key: "end",
146
- value: function end() {
147
- return this._end;
148
- }
149
- }, {
150
- key: "isEmpty",
151
- value: function isEmpty() {
152
- return this._start.equals(this._end);
153
- }
154
- }, {
155
- key: "isUnboundedStart",
156
- value: function isUnboundedStart() {
157
- return this._start.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN);
158
- }
159
- }, {
160
- key: "isUnboundedEnd",
161
- value: function isUnboundedEnd() {
162
- return this._end.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
163
- }
164
- }, {
165
- key: "withStart",
166
- value: function withStart(start) {
167
- return Interval.of(start, this._end);
168
- }
169
- }, {
170
- key: "withEnd",
171
- value: function withEnd(end) {
172
- return Interval.of(this._start, end);
173
- }
174
- }, {
175
- key: "contains",
176
- value: function contains(instant) {
177
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(instant, 'instant');
178
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(instant, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'instant');
179
- return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
180
- }
181
- }, {
182
- key: "encloses",
183
- value: function encloses(other) {
184
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
185
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
186
- return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
187
- }
188
- }, {
189
- key: "abuts",
190
- value: function abuts(other) {
191
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
192
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
193
- return !this._end.equals(other.start()) !== !this._start.equals(other.end());
194
- }
195
- }, {
196
- key: "isConnected",
197
- value: function isConnected(other) {
198
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
199
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
200
- return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
201
- }
202
- }, {
203
- key: "overlaps",
204
- value: function overlaps(other) {
205
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
206
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
207
- return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@js-joda/core')) :
8
+ typeof define === 'function' && define.amd ? define(['exports', '@js-joda/core'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSJodaExtra = {}, global.JSJoda));
10
+ })(this, (function (exports, core) { 'use strict';
11
+
12
+ /**
13
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
14
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
15
+ */
16
+ function requireNonNull(value, parameterName) {
17
+ if (value == null) {
18
+ throw new core.NullPointerException(parameterName + " must not be null");
19
+ }
20
+
21
+ return value;
208
22
  }
209
- }, {
210
- key: "intersection",
211
- value: function intersection(other) {
212
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
213
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
214
-
215
- if (this.isConnected(other) === false) {
216
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: ".concat(this, " and ").concat(other));
23
+ function requireInstance(value, _class, parameterName) {
24
+ if (!(value instanceof _class)) {
25
+ throw new core.IllegalArgumentException(parameterName + " must be an instance of " + (_class.name ? _class.name : _class) + (value && value.constructor && value.constructor.name ? ", but is " + value.constructor.name : ''));
217
26
  }
218
27
 
219
- var cmpStart = this._start.compareTo(other.start());
28
+ return value;
29
+ }
220
30
 
221
- var cmpEnd = this._end.compareTo(other.end());
31
+ /*
32
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
33
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
34
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
35
+ */
36
+ var Interval = function () {
37
+ Interval.of = function of(startInstant, endInstantOrDuration) {
38
+ if (endInstantOrDuration instanceof core.Duration) {
39
+ return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
40
+ } else {
41
+ return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
42
+ }
43
+ };
222
44
 
223
- if (cmpStart >= 0 && cmpEnd <= 0) {
224
- return this;
225
- } else if (cmpStart <= 0 && cmpEnd >= 0) {
226
- return other;
227
- } else {
228
- var newStart = cmpStart >= 0 ? this._start : other.start();
229
- var newEnd = cmpEnd <= 0 ? this._end : other.end();
230
- return Interval.of(newStart, newEnd);
231
- }
232
- }
233
- }, {
234
- key: "union",
235
- value: function union(other) {
236
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
237
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
238
-
239
- if (this.isConnected(other) === false) {
240
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: ".concat(this, " and ").concat(other));
45
+ Interval.ofInstantInstant = function ofInstantInstant(startInclusive, endExclusive) {
46
+ requireNonNull(startInclusive, 'startInclusive');
47
+ requireNonNull(endExclusive, 'endExclusive');
48
+ requireInstance(startInclusive, core.Instant, 'startInclusive');
49
+ requireInstance(endExclusive, core.Instant, 'endExclusive');
50
+
51
+ if (endExclusive.isBefore(startInclusive)) {
52
+ throw new core.DateTimeException('End instant must on or after start instant');
53
+ }
54
+
55
+ return new Interval(startInclusive, endExclusive);
56
+ };
57
+
58
+ Interval.ofInstantDuration = function ofInstantDuration(startInclusive, duration) {
59
+ requireNonNull(startInclusive, 'startInclusive');
60
+ requireNonNull(duration, 'duration');
61
+ requireInstance(startInclusive, core.Instant, 'startInclusive');
62
+ requireInstance(duration, core.Duration, 'duration');
63
+
64
+ if (duration.isNegative()) {
65
+ throw new core.DateTimeException('Duration must not be zero or negative');
66
+ }
67
+
68
+ return new Interval(startInclusive, startInclusive.plus(duration));
69
+ };
70
+
71
+ Interval.parse = function parse(text) {
72
+ requireNonNull(text, 'text');
73
+
74
+ if (!(typeof text === 'string')) {
75
+ throw new core.IllegalArgumentException("text must be a string, but is " + text.constructor.name);
76
+ }
77
+
78
+ for (var i = 0; i < text.length; i += 1) {
79
+ if (text.charAt(i) === '/') {
80
+ var firstChar = text.charAt(0);
81
+
82
+ if (firstChar === 'P' || firstChar === 'p') {
83
+ var duration = core.Duration.parse(text.substring(0, i));
84
+ var end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
85
+ return Interval.of(end.minus(duration), end);
86
+ } else {
87
+ var start = core.ZonedDateTime.parse(text.substring(0, i)).toInstant();
88
+
89
+ if (i + 1 < text.length) {
90
+ var c = text.charAt(i + 1);
91
+
92
+ if (c === 'P' || c === 'p') {
93
+ var _duration = core.Duration.parse(text.substring(i + 1, text.length));
94
+
95
+ return Interval.of(start, start.plus(_duration));
96
+ }
97
+ }
98
+
99
+ var _end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
100
+
101
+ return Interval.of(start, _end);
102
+ }
103
+ }
104
+ }
105
+
106
+ throw new core.DateTimeParseException('Interval cannot be parsed, no forward slash found', text, 0);
107
+ };
108
+
109
+ function Interval(startInclusive, endExclusive) {
110
+ this._start = startInclusive;
111
+ this._end = endExclusive;
241
112
  }
242
113
 
243
- var cmpStart = this._start.compareTo(other.start());
114
+ var _proto = Interval.prototype;
115
+
116
+ _proto.start = function start() {
117
+ return this._start;
118
+ };
119
+
120
+ _proto.end = function end() {
121
+ return this._end;
122
+ };
123
+
124
+ _proto.isEmpty = function isEmpty() {
125
+ return this._start.equals(this._end);
126
+ };
127
+
128
+ _proto.isUnboundedStart = function isUnboundedStart() {
129
+ return this._start.equals(core.Instant.MIN);
130
+ };
131
+
132
+ _proto.isUnboundedEnd = function isUnboundedEnd() {
133
+ return this._end.equals(core.Instant.MAX);
134
+ };
135
+
136
+ _proto.withStart = function withStart(start) {
137
+ return Interval.of(start, this._end);
138
+ };
139
+
140
+ _proto.withEnd = function withEnd(end) {
141
+ return Interval.of(this._start, end);
142
+ };
143
+
144
+ _proto.contains = function contains(instant) {
145
+ requireNonNull(instant, 'instant');
146
+ requireInstance(instant, core.Instant, 'instant');
147
+ return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
148
+ };
149
+
150
+ _proto.encloses = function encloses(other) {
151
+ requireNonNull(other, 'other');
152
+ requireInstance(other, Interval, 'other');
153
+ return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
154
+ };
155
+
156
+ _proto.abuts = function abuts(other) {
157
+ requireNonNull(other, 'other');
158
+ requireInstance(other, Interval, 'other');
159
+ return !this._end.equals(other.start()) !== !this._start.equals(other.end());
160
+ };
161
+
162
+ _proto.isConnected = function isConnected(other) {
163
+ requireNonNull(other, 'other');
164
+ requireInstance(other, Interval, 'other');
165
+ return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
166
+ };
167
+
168
+ _proto.overlaps = function overlaps(other) {
169
+ requireNonNull(other, 'other');
170
+ requireInstance(other, Interval, 'other');
171
+ return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
172
+ };
173
+
174
+ _proto.intersection = function intersection(other) {
175
+ requireNonNull(other, 'other');
176
+ requireInstance(other, Interval, 'other');
177
+
178
+ if (this.isConnected(other) === false) {
179
+ throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
180
+ }
181
+
182
+ var cmpStart = this._start.compareTo(other.start());
183
+
184
+ var cmpEnd = this._end.compareTo(other.end());
185
+
186
+ if (cmpStart >= 0 && cmpEnd <= 0) {
187
+ return this;
188
+ } else if (cmpStart <= 0 && cmpEnd >= 0) {
189
+ return other;
190
+ } else {
191
+ var newStart = cmpStart >= 0 ? this._start : other.start();
192
+ var newEnd = cmpEnd <= 0 ? this._end : other.end();
193
+ return Interval.of(newStart, newEnd);
194
+ }
195
+ };
196
+
197
+ _proto.union = function union(other) {
198
+ requireNonNull(other, 'other');
199
+ requireInstance(other, Interval, 'other');
244
200
 
245
- var cmpEnd = this._end.compareTo(other.end());
201
+ if (this.isConnected(other) === false) {
202
+ throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
203
+ }
204
+
205
+ var cmpStart = this._start.compareTo(other.start());
206
+
207
+ var cmpEnd = this._end.compareTo(other.end());
208
+
209
+ if (cmpStart >= 0 && cmpEnd <= 0) {
210
+ return other;
211
+ } else if (cmpStart <= 0 && cmpEnd >= 0) {
212
+ return this;
213
+ } else {
214
+ var newStart = cmpStart >= 0 ? other.start() : this._start;
215
+ var newEnd = cmpEnd <= 0 ? other.end() : this._end;
216
+ return Interval.of(newStart, newEnd);
217
+ }
218
+ };
219
+
220
+ _proto.span = function span(other) {
221
+ requireNonNull(other, 'other');
222
+ requireInstance(other, Interval, 'other');
223
+
224
+ var cmpStart = this._start.compareTo(other.start());
225
+
226
+ var cmpEnd = this._end.compareTo(other.end());
246
227
 
247
- if (cmpStart >= 0 && cmpEnd <= 0) {
248
- return other;
249
- } else if (cmpStart <= 0 && cmpEnd >= 0) {
250
- return this;
251
- } else {
252
228
  var newStart = cmpStart >= 0 ? other.start() : this._start;
253
229
  var newEnd = cmpEnd <= 0 ? other.end() : this._end;
254
230
  return Interval.of(newStart, newEnd);
255
- }
256
- }
257
- }, {
258
- key: "span",
259
- value: function span(other) {
260
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
261
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
231
+ };
262
232
 
263
- var cmpStart = this._start.compareTo(other.start());
233
+ _proto.isAfter = function isAfter(instantOrInterval) {
234
+ if (instantOrInterval instanceof core.Instant) {
235
+ return this.isAfterInstant(instantOrInterval);
236
+ } else {
237
+ return this.isAfterInterval(instantOrInterval);
238
+ }
239
+ };
264
240
 
265
- var cmpEnd = this._end.compareTo(other.end());
241
+ _proto.isBefore = function isBefore(instantOrInterval) {
242
+ if (instantOrInterval instanceof core.Instant) {
243
+ return this.isBeforeInstant(instantOrInterval);
244
+ } else {
245
+ return this.isBeforeInterval(instantOrInterval);
246
+ }
247
+ };
266
248
 
267
- var newStart = cmpStart >= 0 ? other.start() : this._start;
268
- var newEnd = cmpEnd <= 0 ? other.end() : this._end;
269
- return Interval.of(newStart, newEnd);
270
- }
271
- }, {
272
- key: "isAfter",
273
- value: function isAfter(instantOrInterval) {
274
- if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
275
- return this.isAfterInstant(instantOrInterval);
276
- } else {
277
- return this.isAfterInterval(instantOrInterval);
278
- }
279
- }
280
- }, {
281
- key: "isBefore",
282
- value: function isBefore(instantOrInterval) {
283
- if (instantOrInterval instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"]) {
284
- return this.isBeforeInstant(instantOrInterval);
285
- } else {
286
- return this.isBeforeInterval(instantOrInterval);
287
- }
288
- }
289
- }, {
290
- key: "isAfterInstant",
291
- value: function isAfterInstant(instant) {
292
- return this._start.compareTo(instant) > 0;
293
- }
294
- }, {
295
- key: "isBeforeInstant",
296
- value: function isBeforeInstant(instant) {
297
- return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
298
- }
299
- }, {
300
- key: "isAfterInterval",
301
- value: function isAfterInterval(interval) {
302
- return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
303
- }
304
- }, {
305
- key: "isBeforeInterval",
306
- value: function isBeforeInterval(interval) {
307
- return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
308
- }
309
- }, {
310
- key: "toDuration",
311
- value: function toDuration() {
312
- return _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].between(this._start, this._end);
313
- }
314
- }, {
315
- key: "equals",
316
- value: function equals(obj) {
317
- if (this === obj) {
318
- return true;
319
- }
249
+ _proto.isAfterInstant = function isAfterInstant(instant) {
250
+ return this._start.compareTo(instant) > 0;
251
+ };
320
252
 
321
- if (obj instanceof Interval) {
322
- return this._start.equals(obj.start()) && this._end.equals(obj.end());
323
- }
253
+ _proto.isBeforeInstant = function isBeforeInstant(instant) {
254
+ return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
255
+ };
324
256
 
325
- return false;
326
- }
327
- }, {
328
- key: "hashCode",
329
- value: function hashCode() {
330
- return this._start.hashCode() ^ this._end.hashCode();
331
- }
332
- }, {
333
- key: "toString",
334
- value: function toString() {
335
- return "".concat(this._start.toString(), "/").concat(this._end.toString());
336
- }
337
- }], [{
338
- key: "of",
339
- value: function of(startInstant, endInstantOrDuration) {
340
- if (endInstantOrDuration instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"]) {
341
- return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
342
- } else {
343
- return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
344
- }
345
- }
346
- }, {
347
- key: "ofInstantInstant",
348
- value: function ofInstantInstant(startInclusive, endExclusive) {
349
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
350
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(endExclusive, 'endExclusive');
351
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
352
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(endExclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'endExclusive');
353
-
354
- if (endExclusive.isBefore(startInclusive)) {
355
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('End instant must on or after start instant');
356
- }
257
+ _proto.isAfterInterval = function isAfterInterval(interval) {
258
+ return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
259
+ };
357
260
 
358
- return new Interval(startInclusive, endExclusive);
359
- }
360
- }, {
361
- key: "ofInstantDuration",
362
- value: function ofInstantDuration(startInclusive, duration) {
363
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(startInclusive, 'startInclusive');
364
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(duration, 'duration');
365
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
366
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(duration, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"], 'duration');
367
-
368
- if (duration.isNegative()) {
369
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]('Duration must not be zero or negative');
370
- }
261
+ _proto.isBeforeInterval = function isBeforeInterval(interval) {
262
+ return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
263
+ };
371
264
 
372
- return new Interval(startInclusive, startInclusive.plus(duration));
373
- }
374
- }, {
375
- key: "parse",
376
- value: function parse(text) {
377
- Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(text, 'text');
265
+ _proto.toDuration = function toDuration() {
266
+ return core.Duration.between(this._start, this._end);
267
+ };
378
268
 
379
- if (!(typeof text === 'string')) {
380
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["IllegalArgumentException"]("text must be a string, but is ".concat(text.constructor.name));
381
- }
269
+ _proto.equals = function equals(obj) {
270
+ if (this === obj) {
271
+ return true;
272
+ }
382
273
 
383
- for (var i = 0; i < text.length; i += 1) {
384
- if (text.charAt(i) === '/') {
385
- var firstChar = text.charAt(0);
274
+ if (obj instanceof Interval) {
275
+ return this._start.equals(obj.start()) && this._end.equals(obj.end());
276
+ }
386
277
 
387
- if (firstChar === 'P' || firstChar === 'p') {
388
- var duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(0, i));
389
- var end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
390
- return Interval.of(end.minus(duration), end);
391
- } else {
392
- var start = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(0, i)).toInstant();
278
+ return false;
279
+ };
393
280
 
394
- if (i + 1 < text.length) {
395
- var c = text.charAt(i + 1);
281
+ _proto.hashCode = function hashCode() {
282
+ return this._start.hashCode() ^ this._end.hashCode();
283
+ };
396
284
 
397
- if (c === 'P' || c === 'p') {
398
- var _duration = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"].parse(text.substring(i + 1, text.length));
285
+ _proto.toString = function toString() {
286
+ return this._start.toString() + "/" + this._end.toString();
287
+ };
399
288
 
400
- return Interval.of(start, start.plus(_duration));
401
- }
402
- }
289
+ return Interval;
290
+ }();
291
+ function _init() {
292
+ Interval.ALL = Interval.of(core.Instant.MIN, core.Instant.MAX);
293
+ }
403
294
 
404
- var _end = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(i + 1, text.length)).toInstant();
295
+ /*
296
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
297
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
298
+ */
299
+ var isInit = false;
405
300
 
406
- return Interval.of(start, _end);
407
- }
408
- }
301
+ function init() {
302
+ if (isInit) {
303
+ return;
409
304
  }
410
305
 
411
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeParseException"]('Interval cannot be parsed, no forward slash found', text, 0);
412
- }
413
- }]);
414
-
415
- return Interval;
416
- }();
417
- function _init() {
418
- Interval.ALL = Interval.of(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
419
- }
420
-
421
- /***/ }),
422
-
423
- /***/ "./src/_init.js":
424
- /*!**********************!*\
425
- !*** ./src/_init.js ***!
426
- \**********************/
427
- /*! no exports provided */
428
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
429
-
430
- "use strict";
431
- __webpack_require__.r(__webpack_exports__);
432
- /* harmony import */ var _Interval__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Interval */ "./src/Interval.js");
433
- /*
434
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
435
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
436
- */
437
-
438
- var isInit = false;
439
-
440
- function init() {
441
- if (isInit) {
442
- return;
443
- }
444
-
445
- isInit = true;
446
- Object(_Interval__WEBPACK_IMPORTED_MODULE_0__["_init"])();
447
- }
448
-
449
- init();
450
-
451
- /***/ }),
452
-
453
- /***/ "./src/assert.js":
454
- /*!***********************!*\
455
- !*** ./src/assert.js ***!
456
- \***********************/
457
- /*! exports provided: assert, requireNonNull, requireInstance, abstractMethodFail */
458
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
459
-
460
- "use strict";
461
- __webpack_require__.r(__webpack_exports__);
462
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return assert; });
463
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requireNonNull", function() { return requireNonNull; });
464
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requireInstance", function() { return requireInstance; });
465
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "abstractMethodFail", function() { return abstractMethodFail; });
466
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js-joda/core */ "@js-joda/core");
467
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__);
468
- /**
469
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
470
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
471
- */
472
-
473
- function assert(assertion, msg, error) {
474
- if (!assertion) {
475
- if (error) {
476
- throw new error(msg);
477
- } else {
478
- throw new Error(msg);
306
+ isInit = true;
307
+ _init();
479
308
  }
480
- }
481
- }
482
- function requireNonNull(value, parameterName) {
483
- if (value == null) {
484
- throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["NullPointerException"]("".concat(parameterName, " must not be null"));
485
- }
486
-
487
- return value;
488
- }
489
- function requireInstance(value, _class, parameterName) {
490
- if (!(value instanceof _class)) {
491
- 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) : ''));
492
- }
493
-
494
- return value;
495
- }
496
- function abstractMethodFail(methodName) {
497
- throw new TypeError("abstract method \"".concat(methodName, "\" is not implemented"));
498
- }
499
-
500
- /***/ }),
501
-
502
- /***/ "./src/js-joda-extra.js":
503
- /*!******************************!*\
504
- !*** ./src/js-joda-extra.js ***!
505
- \******************************/
506
- /*! exports provided: Interval */
507
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
508
-
509
- "use strict";
510
- __webpack_require__.r(__webpack_exports__);
511
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js-joda/core */ "@js-joda/core");
512
- /* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__);
513
- /* harmony import */ var _Interval__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Interval */ "./src/Interval.js");
514
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Interval", function() { return _Interval__WEBPACK_IMPORTED_MODULE_1__["Interval"]; });
515
-
516
- /* harmony import */ var _plug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./plug */ "./src/plug.js");
517
- /*
518
- * @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
519
- * @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
520
- */
521
-
522
-
523
-
524
- Object(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["use"])(_plug__WEBPACK_IMPORTED_MODULE_2__["default"]);
525
-
526
-
527
- /***/ }),
528
-
529
- /***/ "./src/plug.js":
530
- /*!*********************!*\
531
- !*** ./src/plug.js ***!
532
- \*********************/
533
- /*! exports provided: default */
534
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
535
-
536
- "use strict";
537
- __webpack_require__.r(__webpack_exports__);
538
- /* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_init */ "./src/_init.js");
539
- /*
540
- * @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
541
- * @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
542
- */
543
-
544
- /* harmony default export */ __webpack_exports__["default"] = (function () {});
545
-
546
- /***/ }),
547
-
548
- /***/ "@js-joda/core":
549
- /*!***************************************************************************************************************!*\
550
- !*** external {"amd":"@js-joda/core","commonjs":"@js-joda/core","commonjs2":"@js-joda/core","root":"JSJoda"} ***!
551
- \***************************************************************************************************************/
552
- /*! no static exports found */
553
- /***/ (function(module, exports) {
554
-
555
- module.exports = __WEBPACK_EXTERNAL_MODULE__js_joda_core__;
556
-
557
- /***/ })
558
-
559
- /******/ });
560
- });
309
+
310
+ init();
311
+
312
+ /*
313
+ * @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
314
+ * @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
315
+ */
316
+ function plug () {}
317
+
318
+ /*
319
+ * @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
320
+ * @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
321
+ */
322
+ core.use(plug);
323
+
324
+ exports.Interval = Interval;
325
+
326
+ Object.defineProperty(exports, '__esModule', { value: true });
327
+
328
+ }));
329
+ //# sourceMappingURL=js-joda-extra.js.map