@@ -2404,6 +2404,13 @@ class Interval {
24042404 return new Interval(this.low, this.high, lowClosed, highClosed);
24052405 }
24062406 }
2407+ pointFrom() {
2408+ const start = this.start();
2409+ if (cmp.equals(start, this.end())) {
2410+ return start;
2411+ }
2412+ throw new Error('PointFrom operator may only be used on an interval containing a single point.');
2413+ }
24072414 toString() {
24082415 const start = this.lowClosed ? '[' : '(';
24092416 const end = this.highClosed ? ']' : ')';
@@ -5015,7 +5022,6 @@ const math_1 = require("../util/math");
50155022const units_1 = require("../util/units");
50165023const dtivl = __importStar(require("../datatypes/interval"));
50175024const builder_1 = require("./builder");
5018- const comparison_1 = require("../util/comparison");
50195025const elmTypes_1 = require("../util/elmTypes");
50205026class Interval extends expression_1.Expression {
50215027 constructor(json) {
@@ -5187,12 +5193,7 @@ class PointFrom extends expression_1.Expression {
51875193 if (interval == null) {
51885194 return null;
51895195 }
5190- const start = interval.start();
5191- const end = interval.end();
5192- if (start == end || (0, comparison_1.equals)(start, end)) {
5193- return start;
5194- }
5195- throw new Error('PointFrom operator may only be used on an interval containing a single point.');
5196+ return interval.pointFrom();
51965197 }
51975198}
51985199exports.PointFrom = PointFrom;
@@ -5781,7 +5782,7 @@ function truncateDecimal(decimal, decimalPlaces) {
57815782 return parseFloat(decimal.toString().match(re)[0]);
57825783}
57835784
5784- },{"../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){
5785+ },{"../datatypes/interval":10,"../datatypes/quantity":12,"../util/elmTypes":55,"../util/math":57,"../util/units":58,"./builder":17,"./expression":23}],28:[function(require,module,exports){
57855786"use strict";
57865787Object.defineProperty(exports, "__esModule", { value: true });
57875788exports.Library = void 0;
0 commit comments