@sc-voice/tools 3.9.0 → 3.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sc-voice/tools",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
4
4
  "description": "Utilities for SC-Voice",
5
5
  "main": "index.mjs",
6
6
  "files": [
@@ -16,6 +16,9 @@ export class Interval {
16
16
 
17
17
  let isClosed = true;
18
18
  if (an && bn) {
19
+ if (b < a) {
20
+ throw new Error(`${msg} invalid interval ${b}<${a}?`);
21
+ }
19
22
  dbg && console.log(msg, 'an bn');
20
23
  lo = a;
21
24
  hi = b;
@@ -110,4 +113,17 @@ export class Interval {
110
113
  hi === INFINITY ? ')' : ']',
111
114
  ].join('');
112
115
  }
116
+
117
+ overlaps(iv2) {
118
+ const msg = 'i6l.overlaps';
119
+ let { lo:lo1, hi:hi1 } = this;
120
+ let { lo:lo2, hi:hi2 } = iv2;
121
+
122
+ //console.log(msg, {lo1, lo2, hi1, hi2});
123
+ return (
124
+ (lo2 <= lo1 && lo1 <= hi2) ||
125
+ (lo2 <= hi1 && hi1 <= hi2) ||
126
+ (lo1 <= lo2 && lo2 <= hi1)
127
+ );
128
+ }
113
129
  }
@@ -217,6 +217,12 @@ export class Unicode {
217
217
  static get ELLIPSIS() {
218
218
  return '\u2026';
219
219
  }
220
+ static get IMPLIES() {
221
+ return '\u21D2';
222
+ }
223
+ static get ELEMENT_OF() {
224
+ return '\u2208';
225
+ }
220
226
  static get A_MACRON() {
221
227
  return '\u0100';
222
228
  }
@@ -346,6 +352,12 @@ export class Unicode {
346
352
  get ELLIPSIS() {
347
353
  return Unicode.ELLIPSIS;
348
354
  }
355
+ get IMPLIES(){
356
+ return Unicode.IMPLIES;
357
+ }
358
+ get ELEMENT_OF() {
359
+ return Unicode.ELEMENT_OF;
360
+ }
349
361
  get A_MACRON() {
350
362
  return Unicode.A_MACRON;
351
363
  }