@trap_stevo/filetide 0.0.87 → 0.0.89

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.
@@ -77,7 +77,7 @@ class FileMessagerClient {
77
77
  }, options, headers, onConnect, onDisconnect, authURL, authHeaders, useAuthentication, queryAuthToken);
78
78
  return () => {
79
79
  this.clientTide.joinChannel(socketName, roomName, userID, () => {
80
- FileTideDebugUtilityManager.outputGradient(`\n[FileTide ~ Tider] ~ Client ~ ${userID} joined room ${roomName} successfully!`, significantMessageColors);
80
+ FileTideDebugUtilityManager.outputGradient(`\n[FileTide ~ Tider] ~ ${userID} joined room ${roomName} successfully!`, significantMessageColors);
81
81
  this.clients.set(userID, {
82
82
  roomName
83
83
  });
@@ -363,7 +363,7 @@ function _createClientInstance(clientID, clientOptions, options = {}, headers =
363
363
  await onDisconnect(...disconnectArguments);
364
364
  }
365
365
  });
366
- FileTideDebugUtilityManager.outputGradient(`\n[FileTide ~ Tider] ~ Created client with ID ${clientID} and socket ${clientID}!`, significantMessageColors);
366
+ FileTideDebugUtilityManager.outputGradient(`\n[FileTide ~ Tider] ~ Created with ID '${clientID}' and origin '${clientID}'!`, significantMessageColors);
367
367
  return clientID;
368
368
  }
369
369
  function _getAdaptiveTideSize(chunkSize, tideSize = 500, minTideSize = 10, maxTideSize = 2000) {
@@ -373,11 +373,6 @@ function _getAdaptiveTideSize(chunkSize, tideSize = 500, minTideSize = 10, maxTi
373
373
  if (networkStatus.state === NETWORK_TRAFFIC_STATES.CONGESTED) {
374
374
  tideDurationMs *= 0.50;
375
375
  }
376
-
377
- /*
378
- * Determine how many chunks current network conditions
379
- * can reasonably support during one Tide duration.
380
- */
381
376
  const networkTideBytes = Math.max(sendRateBps * (tideDurationMs / 1000), chunkSize);
382
377
  const networkTideSize = Math.max(1, Math.floor(networkTideBytes / chunkSize));
383
378
  const normalizedMinTideSize = Math.max(1, minTideSize);
@@ -39,7 +39,6 @@ const {
39
39
  FileTransferStatsManager
40
40
  } = require("./HUDManagers/FileTransferStatsManager.js");
41
41
  const ChunkCapacitor = require("./HUDComponents/ChunkCapacitor.js");
42
- const ConsoleTable = require("./HUDComponents/ConsoleTable.js");
43
42
  const FileMessagerClient = require("./FileMessagerClient.js");
44
43
  const FileTideAnchor = require("./FileTideAnchor.js");
45
44
  var _FileTide_brand = /*#__PURE__*/new WeakSet();
@@ -49,6 +48,8 @@ class FileTide {
49
48
  /**
50
49
  * Set up file transfer event listeners natively.
51
50
  * Automatically checks and creates directories as needed.
51
+ * @param {Object} [options = {}] - Additional messager and transfer lifecycle options.
52
+ * @param {Boolean} [options.displayTransferOutput=true] - Whether FileTide should render transfer lifecycle output directly to the terminal.
52
53
  */
53
54
  _classPrivateMethodInitSpec(this, _FileTide_brand);
54
55
  this.transferStatsManager = new FileTransferStatsManager();
@@ -464,34 +465,9 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
464
465
  onCurrentClientIDAlreadyOnline,
465
466
  onCurrentClientUnauthorized,
466
467
  onBeforeCurrentClientUnauthorizedDisconnect,
467
- onCurrentClientUnauthorizedDisconnect
468
+ onCurrentClientUnauthorizedDisconnect,
469
+ displayTransferOutput = true
468
470
  } = options;
469
- const cliTable = new ConsoleTable({
470
- padding: 2,
471
- headerAlign: "center",
472
- cellAlign: "left",
473
- borderStyle: "bold",
474
- columnOrder: ["clientID", "originClientID", "connectedOnDisplay"],
475
- columnNames: {
476
- clientID: "Client Name",
477
- originClientID: "Origin Name",
478
- connectedOnDisplay: "Connected On"
479
- },
480
- title: "✨ Online ✨",
481
- tableNumber: 1,
482
- gradient: {
483
- title: ["#00FFFF", "#1E90FF"],
484
- header: ["#FFD700", "#FF8C00"],
485
- border: ["#2e2f30", "#788e9e"],
486
- cell: ["#00BFFF", "#1E90FF"]
487
- },
488
- cellColor: (content, column) => {
489
- if (column === "clientID") {
490
- return chalk.blue(content);
491
- }
492
- return content;
493
- }
494
- });
495
471
  const fileTransferReceiver = new FileTransferReceiverManager();
496
472
  client.clientTide.onEvent(userID, "current-online-clients", data => {
497
473
  client.clientTide.emitEvent(userID, "check-client-banned", {
@@ -509,15 +485,11 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
509
485
  }
510
486
  });
511
487
  if (Object.keys(currentClients).length <= 0) {
512
- _FileTide.outputGradient(`\n✨ No Clients Online in ${this.currentChannel} ✨`, significantMessageColors);
513
488
  if (onCurrentOnlineClients) {
514
489
  onCurrentOnlineClients(currentClients, true);
515
490
  }
516
491
  return;
517
492
  }
518
- cliTable.setTitle(`✨ >${Object.keys(currentClients).length}< Online in ${this.currentChannel} ✨`, 1);
519
- cliTable.setData(currentClients);
520
- console.log("\n", cliTable.render(), "\n");
521
493
  if (onCurrentOnlineClients) {
522
494
  onCurrentOnlineClients(currentClients, true);
523
495
  }
@@ -752,7 +724,9 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
752
724
  client.clientTide.onEvent(userID, "transfer-complete", data => {
753
725
  const savePath = FileUtilityManager.getTidePath(path.join(data.filePath, data.fileName));
754
726
  try {
755
- _FileTide.outputGradient(`[${userID}] File transfer complete ~ ${data.fileName}`, significantMessageColors);
727
+ if (displayTransferOutput) {
728
+ _FileTide.outputGradient(`[${userID}] File transfer complete ~ ${data.fileName}`, significantMessageColors);
729
+ }
756
730
  const transferState = FileTransferTrackingManager.getTransfer(data.fileName);
757
731
  FileTideDebugUtilityManager.log("notice", true, `Transfer state ~ ${data.fileName} active | ${transferState !== null && transferState !== undefined ? true : false}`);
758
732
  if (!transferState) {
@@ -760,9 +734,9 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
760
734
  }
761
735
  if (transferState.fileStream) {
762
736
  fileTransferReceiver.completeTransfer(data, (transferData, transfers, success, error) => {
763
- if (success) {
737
+ if (success && displayTransferOutput) {
764
738
  _FileTide.outputGradient(`[${userID}] File saved at ~ ${savePath}\n`, significantMessageColors);
765
- } else if (!success) {
739
+ } else if (!success && displayTransferOutput) {
766
740
  _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n\t${error}\n`, errorMessageColors);
767
741
  }
768
742
  const transferStats = success ? this.transferStatsManager.completeTransfer(data.transferId || data.fileName) : this.transferStatsManager.failTransfer(data.transferId || data.fileName);
@@ -778,7 +752,9 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
778
752
  return;
779
753
  }
780
754
  FileTransferTrackingManager.untrackTransfer(data.fileName);
781
- _FileTide.outputGradient(`[${userID}] Transfer successfully sent to ~ ${data.recipientId} and saved at ~ ${path.join(data.filePath, data.fileName)}\n`, significantMessageColors);
755
+ if (displayTransferOutput) {
756
+ _FileTide.outputGradient(`[${userID}] Transfer successfully sent to ~ ${data.recipientId} and saved at ~ ${path.join(data.filePath, data.fileName)}\n`, significantMessageColors);
757
+ }
782
758
  const transferStats = this.transferStatsManager.completeTransfer(data.transferId || data.fileName);
783
759
  if (onTransferComplete) {
784
760
  onTransferComplete({
@@ -786,10 +762,14 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
786
762
  stats: transferStats
787
763
  }, FileTransferTrackingManager.activeTransfers, true);
788
764
  }
789
- FileTransferTrackingManager.outputCurrentTransfers();
765
+ if (displayTransferOutput) {
766
+ FileTransferTrackingManager.outputCurrentTransfers();
767
+ }
790
768
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
791
769
  } catch (error) {
792
- _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n${error}`, errorMessageColors);
770
+ if (displayTransferOutput) {
771
+ _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n${error}`, errorMessageColors);
772
+ }
793
773
  const transferStats = this.transferStatsManager.failTransfer(data.transferId || data.fileName);
794
774
  if (onTransferComplete) {
795
775
  onTransferComplete({
@@ -797,13 +777,17 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
797
777
  stats: transferStats
798
778
  }, FileTransferTrackingManager.activeTransfers, false);
799
779
  }
800
- FileTransferTrackingManager.outputCurrentTransfers();
780
+ if (displayTransferOutput) {
781
+ FileTransferTrackingManager.outputCurrentTransfers();
782
+ }
801
783
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
802
784
  }
803
785
  });
804
786
  client.clientTide.onEvent(userID, "transfer-failed", async data => {
805
787
  const transferState = FileTransferTrackingManager.getTransfer(data.fileName);
806
- _FileTide.outputGradient(`[${userID}] File transfer failed ~ ${data.fileName}${data.reason ? `\n${data.reason}` : ""}`, errorMessageColors);
788
+ if (displayTransferOutput) {
789
+ _FileTide.outputGradient(`[${userID}] File transfer failed ~ ${data.fileName}${data.reason ? `\n${data.reason}` : ""}`, errorMessageColors);
790
+ }
807
791
  if (transferState?.fileStream) {
808
792
  try {
809
793
  await new Promise(resolve => {
@@ -825,7 +809,9 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
825
809
  if (onTransferComplete) {
826
810
  onTransferComplete(failureData, FileTransferTrackingManager.activeTransfers, false);
827
811
  }
828
- FileTransferTrackingManager.outputCurrentTransfers();
812
+ if (displayTransferOutput) {
813
+ FileTransferTrackingManager.outputCurrentTransfers();
814
+ }
829
815
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
830
816
  });
831
817
  client.clientTide.onEvent(userID, "transfer-requested", async data => {
@@ -869,7 +855,6 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
869
855
  _FileTide.outputGradient(`[${userID} | FileTide Error] ${error}`, errorMessageColors);
870
856
  });
871
857
  client.clientTide.onEvent(userID, "client-file-list-received", async data => {
872
- _FileTide.outputGradient(`[${userID}] Successfully received all ${HUDUtilityManager.convertNumberToMoneyFormat(data.totalItemsSent, false)} contents in ${data.senderID}'s file list!`, significantMessageColors);
873
858
  if (onFileListReceived) {
874
859
  onFileListReceived(data);
875
860
  }
@@ -879,7 +864,6 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
879
864
  clientID: userID,
880
865
  tideID: client.clientTide.sockets[userID].tideID
881
866
  });
882
- _FileTide.outputGradient(`[${userID}] Received ${HUDUtilityManager.convertNumberToMoneyFormat(data.totalItems, false)} directory contents from ${data.senderID}'s file list!`, significantMessageColors);
883
867
  if (onListFiles) {
884
868
  onListFiles(data);
885
869
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "description": "Revolutionizing real-time file transfer with seamless, instant communication across any device. Deliver files instantly, regardless of platform, and experience unparalleled speed and control in managing transfers. Elevate your file-sharing capabilities with a tool designed for precision, efficiency, and effortless connectivity.",
5
5
  "main": "dist/cjs/FileTide.js",
6
6
  "scripts": {
@@ -1,350 +0,0 @@
1
- "use strict";
2
-
3
- const chalk = require("chalk");
4
- class ConsoleTable {
5
- constructor(options = {}) {
6
- this.options = {
7
- padding: 1,
8
- headerAlign: "center",
9
- cellAlign: "left",
10
- borderStyle: "solid",
11
- headerColor: null,
12
- borderColor: null,
13
- cellColor: (content, columnName, rowData) => content,
14
- columnOrder: null,
15
- columnNames: {},
16
- title: "",
17
- tableNumber: null,
18
- gradient: {
19
- title: null,
20
- header: null,
21
- border: null,
22
- cell: null
23
- },
24
- ...options
25
- };
26
- this.borderChars = this.getBorderChars(this.options.borderStyle);
27
- }
28
- getBorderChars(style) {
29
- const styles = {
30
- solid: {
31
- topLeft: "┌",
32
- topRight: "┐",
33
- bottomLeft: "└",
34
- bottomRight: "┘",
35
- horizontal: "─",
36
- vertical: "│",
37
- topJoin: "┬",
38
- bottomJoin: "┴",
39
- leftJoin: "├",
40
- rightJoin: "┤",
41
- center: "┼"
42
- },
43
- double: {
44
- topLeft: "╔",
45
- topRight: "╗",
46
- bottomLeft: "╚",
47
- bottomRight: "╝",
48
- horizontal: "═",
49
- vertical: "║",
50
- topJoin: "╦",
51
- bottomJoin: "╩",
52
- leftJoin: "╠",
53
- rightJoin: "╣",
54
- center: "╬"
55
- },
56
- round: {
57
- topLeft: "╭",
58
- topRight: "╮",
59
- bottomLeft: "╰",
60
- bottomRight: "╯",
61
- horizontal: "─",
62
- vertical: "│",
63
- topJoin: "┬",
64
- bottomJoin: "┴",
65
- leftJoin: "├",
66
- rightJoin: "┤",
67
- center: "┼"
68
- },
69
- bold: {
70
- topLeft: "┏",
71
- topRight: "┓",
72
- bottomLeft: "┗",
73
- bottomRight: "┛",
74
- horizontal: "━",
75
- vertical: "┃",
76
- topJoin: "┳",
77
- bottomJoin: "┻",
78
- leftJoin: "┣",
79
- rightJoin: "┫",
80
- center: "╋"
81
- }
82
- };
83
- return styles[style] || styles["solid"];
84
- }
85
- setData(data) {
86
- if (Array.isArray(data)) {
87
- this.data = data;
88
- } else if (typeof data === "object") {
89
- this.data = Object.values(data);
90
- } else {
91
- throw new Error("Array or an object only.");
92
- }
93
- this.extractColumns();
94
- this.calculateColumnWidths();
95
- }
96
- extractColumns() {
97
- if (this.options.columnOrder && Array.isArray(this.options.columnOrder)) {
98
- this.columns = this.options.columnOrder;
99
- } else {
100
- const columnsSet = new Set();
101
- this.data.forEach(item => {
102
- Object.keys(item).forEach(key => columnsSet.add(key));
103
- });
104
- this.columns = Array.from(columnsSet);
105
- }
106
- }
107
- calculateColumnWidths() {
108
- const {
109
- padding
110
- } = this.options;
111
- this.columnWidths = {};
112
- this.totalWidth = 0;
113
- this.columns.forEach(column => {
114
- const headerName = this.options.columnNames[column] || column;
115
- let maxWidth = String(headerName).length;
116
- this.data.forEach(item => {
117
- const cellContent = item[column] !== undefined ? String(item[column]) : "";
118
- maxWidth = Math.max(maxWidth, cellContent.length);
119
- });
120
- const columnWidth = maxWidth + padding * 2;
121
- this.columnWidths[column] = columnWidth;
122
- this.totalWidth += columnWidth;
123
- });
124
- this.totalWidth += this.columns.length + 1;
125
- }
126
- alignText(text, width, align) {
127
- const {
128
- padding
129
- } = this.options;
130
- const textLength = text.length;
131
- let totalPadding = width - textLength;
132
- let leftPadding = " ".repeat(padding);
133
- let rightPadding = " ".repeat(padding);
134
- if (totalPadding < padding * 2) {
135
- leftPadding = "";
136
- rightPadding = "";
137
- } else {
138
- totalPadding -= padding * 2;
139
- if (align === "left") {
140
- rightPadding += " ".repeat(totalPadding);
141
- } else if (align === "right") {
142
- leftPadding += " ".repeat(totalPadding);
143
- } else {
144
- const half = Math.floor(totalPadding / 2);
145
- leftPadding += " ".repeat(half);
146
- rightPadding += " ".repeat(totalPadding - half);
147
- }
148
- }
149
- return leftPadding + text + rightPadding;
150
- }
151
- generateGradientText(text, startColor, endColor) {
152
- const length = text.length;
153
- const startRGB = this.hexToRgb(startColor);
154
- const endRGB = this.hexToRgb(endColor);
155
- let gradientText = "";
156
- for (let i = 0; i < length; i++) {
157
- const ratio = i / (length - 1 || 1);
158
- const color = {
159
- r: Math.round(startRGB.r + ratio * (endRGB.r - startRGB.r)),
160
- g: Math.round(startRGB.g + ratio * (endRGB.g - startRGB.g)),
161
- b: Math.round(startRGB.b + ratio * (endRGB.b - startRGB.b))
162
- };
163
- gradientText += chalk.rgb(color.r, color.g, color.b)(text[i]);
164
- }
165
- return gradientText;
166
- }
167
- hexToRgb(hex) {
168
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
169
- return result ? {
170
- r: parseInt(result[1], 16),
171
- g: parseInt(result[2], 16),
172
- b: parseInt(result[3], 16)
173
- } : null;
174
- }
175
- generateBorder(type) {
176
- const {
177
- columns,
178
- columnWidths
179
- } = this;
180
- let {
181
- horizontal,
182
- vertical,
183
- topLeft,
184
- topRight,
185
- bottomLeft,
186
- bottomRight,
187
- topJoin,
188
- bottomJoin,
189
- leftJoin,
190
- rightJoin,
191
- center
192
- } = this.borderChars;
193
- const {
194
- borderColor
195
- } = this.options;
196
- const borderGradient = this.options.gradient.border;
197
- if (borderGradient && borderGradient.length === 2) {
198
- const chars = [topLeft, topRight, bottomLeft, bottomRight, horizontal, vertical, topJoin, bottomJoin, leftJoin, rightJoin, center];
199
- const coloredChars = {};
200
- chars.forEach((char, index) => {
201
- coloredChars[char] = this.generateGradientText(char, borderGradient[0], borderGradient[1]);
202
- });
203
- bottomRight = coloredChars[bottomRight];
204
- bottomLeft = coloredChars[bottomLeft];
205
- topRight = coloredChars[topRight];
206
- topLeft = coloredChars[topLeft];
207
- horizontal = coloredChars[horizontal];
208
- vertical = coloredChars[vertical];
209
- bottomJoin = coloredChars[bottomJoin];
210
- rightJoin = coloredChars[rightJoin];
211
- leftJoin = coloredChars[leftJoin];
212
- topJoin = coloredChars[topJoin];
213
- center = coloredChars[center];
214
- } else if (borderColor) {
215
- bottomRight = borderColor(bottomRight);
216
- bottomLeft = borderColor(bottomLeft);
217
- topRight = borderColor(topRight);
218
- topLeft = borderColor(topLeft);
219
- horizontal = borderColor(horizontal);
220
- vertical = borderColor(vertical);
221
- bottomJoin = borderColor(bottomJoin);
222
- rightJoin = borderColor(rightJoin);
223
- leftJoin = borderColor(leftJoin);
224
- topJoin = borderColor(topJoin);
225
- center = borderColor(center);
226
- }
227
- let border = "";
228
- columns.forEach((column, index) => {
229
- const first = index === 0;
230
- const last = index === columns.length - 1;
231
- const width = columnWidths[column];
232
- const line = horizontal.repeat(width);
233
- if (type === "top") {
234
- border += first ? topLeft : topJoin;
235
- } else if (type === "bottom") {
236
- border += first ? bottomLeft : bottomJoin;
237
- } else {
238
- border += first ? leftJoin : center;
239
- }
240
- border += line;
241
- if (last) {
242
- if (type === "top") {
243
- border += topRight;
244
- } else if (type === "bottom") {
245
- border += bottomRight;
246
- } else {
247
- border += rightJoin;
248
- }
249
- }
250
- });
251
- return border;
252
- }
253
- generateRow(rowData, headerRow = false) {
254
- const {
255
- columns,
256
- columnWidths
257
- } = this;
258
- let {
259
- vertical
260
- } = this.borderChars;
261
- const {
262
- headerAlign,
263
- cellAlign,
264
- headerColor,
265
- cellColor
266
- } = this.options;
267
- const align = headerRow ? headerAlign : cellAlign;
268
- const headerGradient = this.options.gradient.header;
269
- const cellGradient = this.options.gradient.cell;
270
- const borderGradient = this.options.gradient.border;
271
- if (borderGradient && borderGradient.length === 2) {
272
- vertical = this.generateGradientText(vertical, borderGradient[0], borderGradient[1]);
273
- } else if (this.options.borderColor) {
274
- vertical = this.options.borderColor(vertical);
275
- }
276
- let row = "";
277
- columns.forEach((column, index) => {
278
- const content = rowData[column] !== undefined ? String(rowData[column]) : "";
279
- const width = columnWidths[column];
280
- const alignedText = this.alignText(content, width, align);
281
- let cellContent = alignedText;
282
- const first = index === 0;
283
- if (headerRow) {
284
- if (headerGradient && headerGradient.length === 2) {
285
- cellContent = this.generateGradientText(cellContent, headerGradient[0], headerGradient[1]);
286
- } else if (headerColor) {
287
- cellContent = headerColor(cellContent);
288
- }
289
- } else {
290
- if (cellGradient && cellGradient.length === 2) {
291
- cellContent = this.generateGradientText(cellContent, cellGradient[0], cellGradient[1]);
292
- } else if (cellColor) {
293
- cellContent = cellColor(cellContent, column, rowData);
294
- }
295
- }
296
- if (first) {
297
- row += vertical;
298
- }
299
- row += cellContent + vertical;
300
- });
301
- return row;
302
- }
303
- setTitle(title, tableNumber = null) {
304
- this.options.title = title;
305
- if (tableNumber !== null) {
306
- this.options.tableNumber = tableNumber;
307
- }
308
- }
309
- renderTitle() {
310
- let titleText = this.options.title;
311
- if (this.options.tableNumber !== null) {
312
- titleText = titleText;
313
- }
314
- const totalWidth = this.totalWidth - 2;
315
- const titleLength = titleText.length;
316
- let leftPadding = Math.floor((totalWidth - titleLength) / 2);
317
- if (leftPadding < 0) leftPadding = 0;
318
- let titleLine = " ".repeat(leftPadding) + titleText;
319
- const titleGradient = this.options.gradient.title;
320
- if (titleGradient && titleGradient.length === 2) {
321
- titleLine = this.generateGradientText(titleLine.trim(), titleGradient[0], titleGradient[1]);
322
- }
323
- return titleLine;
324
- }
325
- render() {
326
- const {
327
- data
328
- } = this;
329
- if (!data || data.length === 0) return "";
330
- const lines = [];
331
- if (this.options.title) {
332
- const title = this.renderTitle();
333
- lines.push(title);
334
- }
335
- lines.push(this.generateBorder("top"));
336
- const headerData = {};
337
- this.columns.forEach(column => {
338
- headerData[column] = this.options.columnNames[column] || column;
339
- });
340
- lines.push(this.generateRow(headerData, true));
341
- lines.push(this.generateBorder("middle"));
342
- data.forEach(rowData => {
343
- lines.push(this.generateRow(rowData));
344
- });
345
- lines.push(this.generateBorder("bottom"));
346
- return lines.join("\n");
347
- }
348
- }
349
- ;
350
- module.exports = ConsoleTable;