@sc-voice/tools 3.5.0 → 3.7.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.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Utilities for SC-Voice",
5
5
  "main": "index.mjs",
6
6
  "files": [
@@ -93,6 +93,15 @@ export class Interval {
93
93
 
94
94
  toString() {
95
95
  let { lo, hi } = this;
96
+ if (lo === hi) {
97
+ return [
98
+ lo === INFINITY ? '(' : '[',
99
+ lo === INFINITY ? MINUS_INFINITY : lo,
100
+ lo == null ? '' : ',',
101
+ hi === INFINITY ? PLUS_INFINITY : hi,
102
+ hi === INFINITY ? ')' : ']',
103
+ ].join('');
104
+ }
96
105
  return [
97
106
  lo === INFINITY ? '(' : '[',
98
107
  lo === INFINITY ? MINUS_INFINITY : lo,
@@ -26,7 +26,7 @@ export class ColorConsole {
26
26
  write = (...args) => console.log.call(null, ...args),
27
27
  colorOk1 = BRIGHT_GREEN,
28
28
  colorOk2 = GREEN,
29
- colorFYI1 = BRIGHT_BLACK,
29
+ colorFyi1 = BRIGHT_BLACK,
30
30
  colorBad1 = BRIGHT_RED,
31
31
  colorBad2 = RED,
32
32
  colorTag1 = CYAN,
@@ -39,7 +39,7 @@ export class ColorConsole {
39
39
  write,
40
40
  colorOk1,
41
41
  colorOk2,
42
- colorFYI1,
42
+ colorFyi1,
43
43
  colorBad1,
44
44
  colorBad2,
45
45
  colorTag1,
@@ -65,47 +65,65 @@ export class ColorConsole {
65
65
  });
66
66
  }
67
67
 
68
- msgLvl(color, msg, lvl, rest) {
69
- return this.color(color, msg + (lvl ? `@${lvl}` : ''), ...rest);
68
+ fyi(...rest) {
69
+ return this.fyi2(...rest);
70
70
  }
71
71
 
72
- ok1(msg, lvl, ...rest) {
72
+ fyi1(...rest) {
73
+ let color = this.colorFyi1;
74
+ this.write(...this.color(color, ...rest));
75
+ }
76
+
77
+ fyi2(...rest) {
78
+ let color = this.colorFyi2;
79
+ this.write(...this.color(color, ...rest));
80
+ }
81
+
82
+ ok(...rest) {
83
+ return this.ok2(...rest);
84
+ }
85
+
86
+ ok1(...rest) {
73
87
  let color = this.colorOk1;
74
- this.write(...this.msgLvl(color, msg, lvl, rest));
88
+ this.write(...this.color(color, ...rest));
75
89
  }
76
90
 
77
- ok2(msg, lvl, ...rest) {
91
+ ok2(...rest) {
78
92
  let color = this.colorOk2;
79
- this.write(...this.msgLvl(color, msg, lvl, rest));
93
+ this.write(...this.color(color, ...rest));
94
+ }
95
+
96
+ bad(...rest) {
97
+ return this.bad2(...rest);
80
98
  }
81
99
 
82
- bad1(msg, lvl, ...rest) {
100
+ bad1(...rest) {
83
101
  let color = this.colorBad1;
84
- this.write(...this.msgLvl(color, msg, lvl, rest));
102
+ this.write(...this.color(color, ...rest));
85
103
  }
86
104
 
87
- bad2(msg, lvl, ...rest) {
105
+ bad2(...rest) {
88
106
  let color = this.colorBad2;
89
- this.write(...this.msgLvl(color, msg, lvl, rest));
107
+ this.write(...this.color(color, ...rest));
90
108
  }
91
109
 
92
- tag1(msg, lvl, ...rest) {
110
+ tag1(...rest) {
93
111
  let color = this.colorTag1;
94
- this.write(...this.msgLvl(color, msg, lvl, rest));
112
+ this.write(...this.color(color, ...rest));
95
113
  }
96
114
 
97
- tag2(msg, lvl, ...rest) {
115
+ tag2(...rest) {
98
116
  let color = this.colorTag2;
99
- this.write(...this.msgLvl(color, msg, lvl, rest));
117
+ this.write(...this.color(color, ...rest));
100
118
  }
101
119
 
102
120
  tag3(msg, lvl, ...rest) {
103
121
  let color = this.colorTag3;
104
- this.write(...this.msgLvl(color, msg, lvl, rest));
122
+ this.write(...this.color(color, ...rest));
105
123
  }
106
124
 
107
125
  tag4(msg, lvl, ...rest) {
108
126
  let color = this.colorTag4;
109
- this.write(...this.msgLvl(color, msg, lvl, rest));
127
+ this.write(...this.color(color, ...rest));
110
128
  }
111
129
  }