@sc-voice/tools 3.29.0 → 3.30.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.
- package/package.json +1 -1
- package/src/math/interval.mjs +17 -8
package/package.json
CHANGED
package/src/math/interval.mjs
CHANGED
|
@@ -9,7 +9,8 @@ const MINUS_INFINITY = `-${INFINITY}`;
|
|
|
9
9
|
const PLUS_INFINITY = `+${INFINITY}`;
|
|
10
10
|
|
|
11
11
|
export class Interval {
|
|
12
|
-
styleText = (text)=>text;
|
|
12
|
+
static styleText = (text)=>text;
|
|
13
|
+
static collapseDegenerate = false;
|
|
13
14
|
|
|
14
15
|
constructor(a, b, opts = {}) {
|
|
15
16
|
const msg = 'i6l.ctor';
|
|
@@ -137,13 +138,21 @@ export class Interval {
|
|
|
137
138
|
let result = EMPTY_SET;
|
|
138
139
|
if (!isEmpty) {
|
|
139
140
|
if (lo === hi) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
if (Interval.collapseDegenerate) {
|
|
142
|
+
result = [
|
|
143
|
+
leftOpen ? '(' : '[',
|
|
144
|
+
lo === INFINITY ? MINUS_INFINITY : lo,
|
|
145
|
+
rightOpen ? ')' : ']',
|
|
146
|
+
].join('');
|
|
147
|
+
} else {
|
|
148
|
+
result = [
|
|
149
|
+
leftOpen ? '(' : '[',
|
|
150
|
+
lo === INFINITY ? MINUS_INFINITY : lo,
|
|
151
|
+
lo == null ? '' : ',',
|
|
152
|
+
hi === INFINITY ? PLUS_INFINITY : hi,
|
|
153
|
+
rightOpen ? ')' : ']',
|
|
154
|
+
].join('');
|
|
155
|
+
}
|
|
147
156
|
} else {
|
|
148
157
|
result = [
|
|
149
158
|
leftOpen ? '(' : '[',
|