table 3.8.2 → 4.0.3

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.
Files changed (56) hide show
  1. package/README.md +35 -16
  2. package/dist/alignString.js +19 -842
  3. package/dist/alignTableData.js +4 -226
  4. package/dist/calculateCellHeight.js +6 -343
  5. package/dist/calculateCellWidthIndex.js +2 -112
  6. package/dist/calculateMaximumColumnWidthIndex.js +5 -299
  7. package/dist/calculateRowHeightIndex.js +8 -333
  8. package/dist/createStream.js +19 -814
  9. package/dist/drawBorder.js +11 -292
  10. package/dist/drawRow.js +1 -69
  11. package/dist/drawTable.js +7 -474
  12. package/dist/getBorderCharacters.js +1 -315
  13. package/dist/index.js +4 -28
  14. package/dist/makeConfig.js +15 -544
  15. package/dist/makeStreamConfig.js +13 -587
  16. package/dist/mapDataUsingRowHeightIndex.js +9 -349
  17. package/dist/padTableData.js +5 -166
  18. package/dist/schemas/config.json +2 -2
  19. package/dist/schemas/streamConfig.json +2 -2
  20. package/dist/stringifyTableData.js +4 -116
  21. package/dist/table.js +5 -203
  22. package/dist/truncateTableData.js +3 -147
  23. package/dist/validateConfig.js +20 -23
  24. package/dist/validateStreamConfig.js +17 -19
  25. package/dist/validateTableData.js +11 -528
  26. package/dist/wrapString.js +3 -135
  27. package/dist/wrapWord.js +4 -257
  28. package/package.json +27 -24
  29. package/test/README/usage/basic.js +0 -25
  30. package/test/README/usage/cell_content_alignment.js +0 -45
  31. package/test/README/usage/column_width.js +0 -33
  32. package/test/README/usage/custom_border.js +0 -50
  33. package/test/README/usage/draw_horizontal_line.js +0 -41
  34. package/test/README/usage/expectTable.js +0 -13
  35. package/test/README/usage/moon_mission.js +0 -67
  36. package/test/README/usage/padding_cell_content.js +0 -39
  37. package/test/README/usage/predefined_border_templates.js +0 -91
  38. package/test/README/usage/streaming.js +0 -56
  39. package/test/README/usage/text_truncating.js +0 -32
  40. package/test/README/usage/text_wrapping.js +0 -67
  41. package/test/alignString.js +0 -102
  42. package/test/calculateCellHeight.js +0 -44
  43. package/test/calculateCellWidthIndex.js +0 -20
  44. package/test/calculateMaximumColumnWidthIndex.js +0 -59
  45. package/test/calculateRowHeightIndex.js +0 -78
  46. package/test/config.js +0 -43
  47. package/test/configSamples.js +0 -153
  48. package/test/createStream.js +0 -41
  49. package/test/drawBorder.js +0 -71
  50. package/test/makeConfig.js +0 -75
  51. package/test/mapDataUsingRowHeightIndex.js +0 -119
  52. package/test/streamConfig.js +0 -43
  53. package/test/streamConfigSamples.js +0 -151
  54. package/test/validateTableData.js +0 -65
  55. package/test/wrapString.js +0 -45
  56. package/test/wrapWord.js +0 -32
package/dist/drawTable.js CHANGED
@@ -4,438 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var cov_ju3qj393e = function () {
8
- var path = '/Users/gajuskuizinas/Documents/dev/gajus/table/src/drawTable.js',
9
- hash = '6094a56cd4ea760b5f41ea29d3e5d124edb7067e',
10
- global = new Function('return this')(),
11
- gcv = '__coverage__',
12
- coverageData = {
13
- path: '/Users/gajuskuizinas/Documents/dev/gajus/table/src/drawTable.js',
14
- statementMap: {
15
- '0': {
16
- start: {
17
- line: 22,
18
- column: 19
19
- },
20
- end: {
21
- line: 22,
22
- column: 30
23
- }
24
- },
25
- '1': {
26
- start: {
27
- line: 24,
28
- column: 2
29
- },
30
- end: {
31
- line: 24,
32
- column: 19
33
- }
34
- },
35
- '2': {
36
- start: {
37
- line: 26,
38
- column: 2
39
- },
40
- end: {
41
- line: 26,
42
- column: 14
43
- }
44
- },
45
- '3': {
46
- start: {
47
- line: 28,
48
- column: 2
49
- },
50
- end: {
51
- line: 30,
52
- column: 3
53
- }
54
- },
55
- '4': {
56
- start: {
57
- line: 29,
58
- column: 4
59
- },
60
- end: {
61
- line: 29,
62
- column: 53
63
- }
64
- },
65
- '5': {
66
- start: {
67
- line: 32,
68
- column: 2
69
- },
70
- end: {
71
- line: 46,
72
- column: 5
73
- }
74
- },
75
- '6': {
76
- start: {
77
- line: 33,
78
- column: 4
79
- },
80
- end: {
81
- line: 33,
82
- column: 35
83
- }
84
- },
85
- '7': {
86
- start: {
87
- line: 35,
88
- column: 4
89
- },
90
- end: {
91
- line: 39,
92
- column: 5
93
- }
94
- },
95
- '8': {
96
- start: {
97
- line: 36,
98
- column: 6
99
- },
100
- end: {
101
- line: 36,
102
- column: 45
103
- }
104
- },
105
- '9': {
106
- start: {
107
- line: 38,
108
- column: 6
109
- },
110
- end: {
111
- line: 38,
112
- column: 21
113
- }
114
- },
115
- '10': {
116
- start: {
117
- line: 41,
118
- column: 4
119
- },
120
- end: {
121
- line: 41,
122
- column: 16
123
- }
124
- },
125
- '11': {
126
- start: {
127
- line: 43,
128
- column: 4
129
- },
130
- end: {
131
- line: 45,
132
- column: 5
133
- }
134
- },
135
- '12': {
136
- start: {
137
- line: 44,
138
- column: 6
139
- },
140
- end: {
141
- line: 44,
142
- column: 56
143
- }
144
- },
145
- '13': {
146
- start: {
147
- line: 48,
148
- column: 2
149
- },
150
- end: {
151
- line: 50,
152
- column: 3
153
- }
154
- },
155
- '14': {
156
- start: {
157
- line: 49,
158
- column: 4
159
- },
160
- end: {
161
- line: 49,
162
- column: 56
163
- }
164
- },
165
- '15': {
166
- start: {
167
- line: 52,
168
- column: 2
169
- },
170
- end: {
171
- line: 52,
172
- column: 16
173
- }
174
- }
175
- },
176
- fnMap: {
177
- '0': {
178
- name: '(anonymous_0)',
179
- decl: {
180
- start: {
181
- line: 17,
182
- column: 15
183
- },
184
- end: {
185
- line: 17,
186
- column: 16
187
- }
188
- },
189
- loc: {
190
- start: {
191
- line: 17,
192
- column: 84
193
- },
194
- end: {
195
- line: 53,
196
- column: 1
197
- }
198
- }
199
- },
200
- '1': {
201
- name: '(anonymous_1)',
202
- decl: {
203
- start: {
204
- line: 32,
205
- column: 18
206
- },
207
- end: {
208
- line: 32,
209
- column: 19
210
- }
211
- },
212
- loc: {
213
- start: {
214
- line: 32,
215
- column: 35
216
- },
217
- end: {
218
- line: 46,
219
- column: 3
220
- }
221
- }
222
- }
223
- },
224
- branchMap: {
225
- '0': {
226
- loc: {
227
- start: {
228
- line: 28,
229
- column: 2
230
- },
231
- end: {
232
- line: 30,
233
- column: 3
234
- }
235
- },
236
- type: 'if',
237
- locations: [{
238
- start: {
239
- line: 28,
240
- column: 2
241
- },
242
- end: {
243
- line: 30,
244
- column: 3
245
- }
246
- }, {
247
- start: {
248
- line: 28,
249
- column: 2
250
- },
251
- end: {
252
- line: 30,
253
- column: 3
254
- }
255
- }]
256
- },
257
- '1': {
258
- loc: {
259
- start: {
260
- line: 35,
261
- column: 4
262
- },
263
- end: {
264
- line: 39,
265
- column: 5
266
- }
267
- },
268
- type: 'if',
269
- locations: [{
270
- start: {
271
- line: 35,
272
- column: 4
273
- },
274
- end: {
275
- line: 39,
276
- column: 5
277
- }
278
- }, {
279
- start: {
280
- line: 35,
281
- column: 4
282
- },
283
- end: {
284
- line: 39,
285
- column: 5
286
- }
287
- }]
288
- },
289
- '2': {
290
- loc: {
291
- start: {
292
- line: 43,
293
- column: 4
294
- },
295
- end: {
296
- line: 45,
297
- column: 5
298
- }
299
- },
300
- type: 'if',
301
- locations: [{
302
- start: {
303
- line: 43,
304
- column: 4
305
- },
306
- end: {
307
- line: 45,
308
- column: 5
309
- }
310
- }, {
311
- start: {
312
- line: 43,
313
- column: 4
314
- },
315
- end: {
316
- line: 45,
317
- column: 5
318
- }
319
- }]
320
- },
321
- '3': {
322
- loc: {
323
- start: {
324
- line: 43,
325
- column: 8
326
- },
327
- end: {
328
- line: 43,
329
- column: 96
330
- }
331
- },
332
- type: 'binary-expr',
333
- locations: [{
334
- start: {
335
- line: 43,
336
- column: 8
337
- },
338
- end: {
339
- line: 43,
340
- column: 23
341
- }
342
- }, {
343
- start: {
344
- line: 43,
345
- column: 27
346
- },
347
- end: {
348
- line: 43,
349
- column: 50
350
- }
351
- }, {
352
- start: {
353
- line: 43,
354
- column: 54
355
- },
356
- end: {
357
- line: 43,
358
- column: 96
359
- }
360
- }]
361
- },
362
- '4': {
363
- loc: {
364
- start: {
365
- line: 48,
366
- column: 2
367
- },
368
- end: {
369
- line: 50,
370
- column: 3
371
- }
372
- },
373
- type: 'if',
374
- locations: [{
375
- start: {
376
- line: 48,
377
- column: 2
378
- },
379
- end: {
380
- line: 50,
381
- column: 3
382
- }
383
- }, {
384
- start: {
385
- line: 48,
386
- column: 2
387
- },
388
- end: {
389
- line: 50,
390
- column: 3
391
- }
392
- }]
393
- }
394
- },
395
- s: {
396
- '0': 0,
397
- '1': 0,
398
- '2': 0,
399
- '3': 0,
400
- '4': 0,
401
- '5': 0,
402
- '6': 0,
403
- '7': 0,
404
- '8': 0,
405
- '9': 0,
406
- '10': 0,
407
- '11': 0,
408
- '12': 0,
409
- '13': 0,
410
- '14': 0,
411
- '15': 0
412
- },
413
- f: {
414
- '0': 0,
415
- '1': 0
416
- },
417
- b: {
418
- '0': [0, 0],
419
- '1': [0, 0],
420
- '2': [0, 0],
421
- '3': [0, 0, 0],
422
- '4': [0, 0]
423
- }
424
- },
425
- coverage = global[gcv] || (global[gcv] = {});
426
-
427
- if (coverage[path] && coverage[path].hash === hash) {
428
- return coverage[path];
429
- }
430
-
431
- coverageData.hash = hash;
432
- return coverage[path] = coverageData;
433
- }();
434
-
435
- var _lodash = require('lodash');
436
-
437
- var _lodash2 = _interopRequireDefault(_lodash);
438
-
439
7
  var _drawBorder = require('./drawBorder');
440
8
 
441
9
  var _drawRow = require('./drawRow');
@@ -453,74 +21,39 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
453
21
  * @returns {string}
454
22
  */
455
23
  exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
456
- ++cov_ju3qj393e.f[0];
24
+ let output;
25
+ let realRowIndex;
26
+ let rowHeight;
457
27
 
458
- let output, realRowIndex, rowHeight;
28
+ const rowCount = rows.length;
459
29
 
460
- const rowCount = (++cov_ju3qj393e.s[0], rows.length);
461
-
462
- ++cov_ju3qj393e.s[1];
463
30
  realRowIndex = 0;
464
31
 
465
- ++cov_ju3qj393e.s[2];
466
32
  output = '';
467
33
 
468
- ++cov_ju3qj393e.s[3];
469
34
  if (drawHorizontalLine(realRowIndex, rowCount)) {
470
- ++cov_ju3qj393e.b[0][0];
471
- ++cov_ju3qj393e.s[4];
472
-
473
35
  output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border);
474
- } else {
475
- ++cov_ju3qj393e.b[0][1];
476
36
  }
477
37
 
478
- ++cov_ju3qj393e.s[5];
479
- _lodash2.default.forEach(rows, (row, index0) => {
480
- ++cov_ju3qj393e.f[1];
481
- ++cov_ju3qj393e.s[6];
482
-
38
+ rows.forEach((row, index0) => {
483
39
  output += (0, _drawRow2.default)(row, border);
484
40
 
485
- ++cov_ju3qj393e.s[7];
486
41
  if (!rowHeight) {
487
- ++cov_ju3qj393e.b[1][0];
488
- ++cov_ju3qj393e.s[8];
489
-
490
42
  rowHeight = rowSpanIndex[realRowIndex];
491
43
 
492
- ++cov_ju3qj393e.s[9];
493
44
  realRowIndex++;
494
- } else {
495
- ++cov_ju3qj393e.b[1][1];
496
45
  }
497
46
 
498
- ++cov_ju3qj393e.s[10];
499
47
  rowHeight--;
500
48
 
501
- ++cov_ju3qj393e.s[11];
502
- if ((++cov_ju3qj393e.b[3][0], rowHeight === 0) && (++cov_ju3qj393e.b[3][1], index0 !== rowCount - 1) && (++cov_ju3qj393e.b[3][2], drawHorizontalLine(realRowIndex, rowCount))) {
503
- ++cov_ju3qj393e.b[2][0];
504
- ++cov_ju3qj393e.s[12];
505
-
49
+ if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
506
50
  output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border);
507
- } else {
508
- ++cov_ju3qj393e.b[2][1];
509
51
  }
510
52
  });
511
53
 
512
- ++cov_ju3qj393e.s[13];
513
54
  if (drawHorizontalLine(realRowIndex, rowCount)) {
514
- ++cov_ju3qj393e.b[4][0];
515
- ++cov_ju3qj393e.s[14];
516
-
517
55
  output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border);
518
- } else {
519
- ++cov_ju3qj393e.b[4][1];
520
56
  }
521
57
 
522
- ++cov_ju3qj393e.s[15];
523
58
  return output;
524
- };
525
-
526
- module.exports = exports['default'];
59
+ };