@@ -2412,6 +2412,13 @@ class Interval {
24122412 return new Interval(this.low, this.high, lowClosed, highClosed);
24132413 }
24142414 }
2415+ pointFrom() {
2416+ const start = this.start();
2417+ if (cmp.equals(start, this.end())) {
2418+ return start;
2419+ }
2420+ throw new Error('PointFrom operator may only be used on an interval containing a single point.');
2421+ }
24152422 toString() {
24162423 const start = this.lowClosed ? '[' : '(';
24172424 const end = this.highClosed ? ']' : ')';
@@ -5101,7 +5108,6 @@ const math_1 = require("../util/math");
51015108const units_1 = require("../util/units");
51025109const dtivl = __importStar(require("../datatypes/interval"));
51035110const builder_1 = require("./builder");
5104- const comparison_1 = require("../util/comparison");
51055111const elmTypes_1 = require("../util/elmTypes");
51065112class Interval extends expression_1.Expression {
51075113 constructor(json) {
@@ -5273,12 +5279,7 @@ class PointFrom extends expression_1.Expression {
52735279 if (interval == null) {
52745280 return null;
52755281 }
5276- const start = interval.start();
5277- const end = interval.end();
5278- if (start == end || (0, comparison_1.equals)(start, end)) {
5279- return start;
5280- }
5281- throw new Error('PointFrom operator may only be used on an interval containing a single point.');
5282+ return interval.pointFrom();
52825283 }
52835284}
52845285exports.PointFrom = PointFrom;
@@ -5867,7 +5868,7 @@ function truncateDecimal(decimal, decimalPlaces) {
58675868 return parseFloat(decimal.toString().match(re)[0]);
58685869}
58695870
5870- },{"../datatypes/interval":10,"../datatypes/quantity":12,"../util/comparison":53,"../util/ elmTypes":55,"../util/math":57,"../util/units":58,"./builder":17,"./expression":23}],28:[function(require,module,exports){
5871+ },{"../datatypes/interval":10,"../datatypes/quantity":12,"../util/elmTypes":55,"../util/math":57,"../util/units":58,"./builder":17,"./expression":23}],28:[function(require,module,exports){
58715872"use strict";
58725873Object.defineProperty(exports, "__esModule", { value: true });
58735874exports.Library = void 0;
0 commit comments