diff options
| author | Bobby <[email protected]> | 2022-01-26 14:02:00 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-01-26 14:02:00 -0500 |
| commit | dca40908a25b155dfed169f0260ec3083df90ed1 (patch) | |
| tree | 58881f81ab9fff311a7618a158ae6e85bd13f609 /src/lib | |
| parent | 901901f0cc4795305d368f588a2d18fe2a8e28b2 (diff) | |
| download | izuku.js-dca40908a25b155dfed169f0260ec3083df90ed1.tar.xz izuku.js-dca40908a25b155dfed169f0260ec3083df90ed1.zip | |
chore: remove table dependency and replace it with internal function
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/display.ts | 7 | ||||
| -rw-r--r-- | src/lib/info.ts | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/display.ts b/src/lib/display.ts index 2ec19d9..d56b9d9 100644 --- a/src/lib/display.ts +++ b/src/lib/display.ts @@ -1,5 +1,4 @@ import { Frame } from '../index'; -import { table } from 'table'; import { Table } from '../helpers/tableBuilder'; /** @@ -80,7 +79,7 @@ export function show(this: Frame): void { } else { const numberOfRows = this.rowdata.length; if (numberOfRows < 7) { - console.log(table(getTable(this.rowdata, this.columns))); + displayTable(getTable(this.rowdata, this.columns)); } else { const firstThreeRows = this.rowdata.slice(0, 3); const lastThreeRows = this.rowdata.slice(numberOfRows - 3); @@ -121,7 +120,7 @@ export function head(this: Frame, n = 5): void { // Generate the index row const indexRow = this.rowdata.map((row, index) => index); const data = this.rowdata.slice(0, n); - console.log(table(getTable(data, this.columns, indexRow))); + displayTable(getTable(data, this.columns, indexRow)); } } @@ -145,6 +144,6 @@ export function tail(this: Frame, n = 5): void { const data = this.rowdata.slice(this.rowdata.length - n); // Slice the index row to match the data const slicedIndexRow = indexRow.slice(indexRow.length - n); - console.log(table(getTable(data, this.columns, slicedIndexRow))); + displayTable(getTable(data, this.columns, slicedIndexRow)); } } diff --git a/src/lib/info.ts b/src/lib/info.ts index 3753782..98a6249 100644 --- a/src/lib/info.ts +++ b/src/lib/info.ts @@ -1,7 +1,7 @@ import { Frame } from '../index'; -import { table } from 'table'; import { sizeof } from '../helpers/memorySize'; import { flatten } from './data'; +import { displayTable } from './display'; /** * size returns the total number of elements in the frame * @returns the total number of elements in the frame @@ -74,9 +74,7 @@ export function info(this: Frame): void { .split(' x ')[1] .trim()} columns` ); - console.log(table(info)); - // Remove the previous printed newline - process.stdout.write('\x1B[1A\x1B[2K'); + displayTable(info); console.log(`Data Types: ${dataTypesString}`); console.log(`Memory Usage: ${sizeof(this)} bytes`); } |
