@sc-voice/tools 3.21.0 → 3.22.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/text/list.mjs +19 -9
package/package.json
CHANGED
package/src/text/list.mjs
CHANGED
|
@@ -11,11 +11,19 @@ export class ListFactory {
|
|
|
11
11
|
nColumns = 0,
|
|
12
12
|
nRows = 0,
|
|
13
13
|
nLists = 0,
|
|
14
|
+
rowSeparator = '\n',
|
|
15
|
+
colSeparator = ' ',
|
|
16
|
+
order = 'column-major',
|
|
17
|
+
precision = 3,
|
|
14
18
|
} = opts;
|
|
15
19
|
Object.assign(this, {
|
|
16
20
|
nColumns,
|
|
17
21
|
nRows,
|
|
18
22
|
nLists,
|
|
23
|
+
order,
|
|
24
|
+
precision,
|
|
25
|
+
rowSeparator,
|
|
26
|
+
colSeparator,
|
|
19
27
|
});
|
|
20
28
|
}
|
|
21
29
|
|
|
@@ -32,7 +40,7 @@ export class ListFactory {
|
|
|
32
40
|
values=[],
|
|
33
41
|
separator = ',', // join() separator
|
|
34
42
|
widths, // element string widths
|
|
35
|
-
precision =
|
|
43
|
+
precision = this.precision, // numeric precision
|
|
36
44
|
} = opts;
|
|
37
45
|
|
|
38
46
|
let list = [...values];
|
|
@@ -118,7 +126,7 @@ export class ListFactory {
|
|
|
118
126
|
name,
|
|
119
127
|
values=[],
|
|
120
128
|
separator = '\n',
|
|
121
|
-
precision,
|
|
129
|
+
precision = this.precision,
|
|
122
130
|
} = opts;
|
|
123
131
|
|
|
124
132
|
this.nColumns++;
|
|
@@ -139,7 +147,7 @@ export class ListFactory {
|
|
|
139
147
|
values=[],
|
|
140
148
|
separator = '\t',
|
|
141
149
|
widths,
|
|
142
|
-
precision,
|
|
150
|
+
precision = this.precision,
|
|
143
151
|
} = opts;
|
|
144
152
|
|
|
145
153
|
this.nRows++;
|
|
@@ -156,22 +164,24 @@ export class ListFactory {
|
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
wrapList(list, opts = {}) {
|
|
159
|
-
const msg = '
|
|
167
|
+
const msg = 'l9y.wrapList';
|
|
160
168
|
const dbg = 0;
|
|
161
169
|
let {
|
|
162
170
|
name,
|
|
163
171
|
maxValues = 2,
|
|
164
172
|
namePrefix = 'column',
|
|
165
|
-
order =
|
|
166
|
-
rowSeparator =
|
|
167
|
-
colSeparator =
|
|
173
|
+
order = this.order,
|
|
174
|
+
rowSeparator = this.rowSeparator,
|
|
175
|
+
colSeparator = this.colSeparator,
|
|
176
|
+
precision = this.precision,
|
|
168
177
|
} = opts;
|
|
169
178
|
|
|
170
|
-
let singleList =
|
|
179
|
+
let singleList = this.createColumn({
|
|
171
180
|
name,
|
|
172
181
|
separator:rowSeparator,
|
|
182
|
+
precision,
|
|
173
183
|
});
|
|
174
|
-
let newRow = (separator) =>
|
|
184
|
+
let newRow = (separator) => this.createRow({ separator, precision });
|
|
175
185
|
name = name || singleList.name;
|
|
176
186
|
switch (order) {
|
|
177
187
|
case 'col-major':
|