You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

console-table-printer

Package Overview
Dependencies
Maintainers
1
Versions
274
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-table-printer - npm Package Compare versions

Comparing version

to
2.14.1

10

dist/src/internalTable/input-converter.d.ts

@@ -1,3 +0,2 @@

import { ALIGNMENT, COLOR } from '../models/common';
import { ColumnOptionsRaw } from '../models/external-table';
import { ColumnOptionsRaw, ComputedColumn, DefaultColumnOptions } from '../models/external-table';
import { Column } from '../models/internal-table';

@@ -7,7 +6,2 @@ export declare const objIfExists: (key: string, val: any) => {

};
export declare const rawColumnToInternalColumn: (column: ColumnOptionsRaw, defaultColumnStyles?: {
alignment?: ALIGNMENT;
color?: COLOR;
maxLen?: number;
minLen?: number;
}) => Column;
export declare const rawColumnToInternalColumn: (column: ColumnOptionsRaw | ComputedColumn, defaultColumnStyles?: DefaultColumnOptions) => Column;

3

dist/src/internalTable/internal-table.d.ts
import { CharLengthDict, Dictionary, Row } from '../models/common';
import { ColumnOptionsRaw, ComplexOptions, ComputedColumn, RowFilterFunction, RowSortFunction } from '../models/external-table';
import { ColumnOptionsRaw, ComplexOptions, ComputedColumn, DefaultColumnOptions, RowFilterFunction, RowSortFunction } from '../models/external-table';
import { Column, TableStyleDetails } from '../models/internal-table';

@@ -19,2 +19,3 @@ import { ColorMap } from '../utils/colored-console-line';

charLength: CharLengthDict;
defaultColumnOptions?: DefaultColumnOptions;
initSimple(columns: string[]): void;

@@ -21,0 +22,0 @@ initDetailed(options: ComplexOptions): void;

@@ -31,2 +31,3 @@ "use strict";

this.charLength = (options === null || options === void 0 ? void 0 : options.charLength) || this.charLength;
this.defaultColumnOptions = (options === null || options === void 0 ? void 0 : options.defaultColumnOptions) || this.defaultColumnOptions;
if (options === null || options === void 0 ? void 0 : options.shouldDisableColors) {

@@ -56,2 +57,3 @@ this.colorMap = {};

this.charLength = {};
this.defaultColumnOptions = undefined;
if (options instanceof Array) {

@@ -76,5 +78,2 @@ this.initSimple(options);

}
else if ('function' in textOrObj) { // Only way to know if this is a computed column
this.columns.push((0, table_helpers_1.createColumFromComputedColumn)(textOrObj));
}
else {

@@ -81,0 +80,0 @@ this.columns.push((0, input_converter_1.rawColumnToInternalColumn)(textOrObj));

@@ -5,2 +5,3 @@ "use strict";

const table_helpers_1 = require("../utils/table-helpers");
// All these functions are ran when renderTable/printTable is called
const createComputedColumnsIfNecessary = (table) => {

@@ -14,3 +15,3 @@ if (table.computedColumns.length) {

}
table.addColumn(computedColumn);
table.addColumn(Object.assign(Object.assign({}, computedColumn), table.defaultColumnOptions));
table.rows.forEach((row, index, rowsArray) => {

@@ -17,0 +18,0 @@ const arrayRowText = rowsArray.map((elemInRowsArray) => elemInRowsArray.text);

@@ -18,2 +18,9 @@ import { ColorMap } from '../utils/colored-console-line';

export type RowFilterFunction = (row: any) => Boolean;
export interface DefaultColumnOptions {
alignment?: ALIGNMENT;
color?: COLOR;
title?: string;
maxLen?: number;
minLen?: number;
}
export interface ComplexOptions {

@@ -33,9 +40,3 @@ style?: TableStyleDetails;

charLength?: CharLengthDict;
defaultColumnOptions?: {
alignment?: ALIGNMENT;
color?: COLOR;
title?: string;
maxLen?: number;
minLen?: number;
};
defaultColumnOptions?: DefaultColumnOptions;
}
import { CharLengthDict, COLOR, Dictionary, Row } from '../models/common';
import { ComputedColumn } from '../models/external-table';
import { Column } from '../models/internal-table';

@@ -21,3 +20,2 @@ export declare const cellText: (text: string | number) => string;

export declare const createColumFromOnlyName: (name: string) => Column;
export declare const createColumFromComputedColumn: (column: ComputedColumn) => Column;
export declare const createRow: (color: COLOR, text: Dictionary, separator: boolean) => Row;

@@ -24,0 +22,0 @@ export declare const findLenOfColumn: (column: Column, rows: Row[], charLength?: CharLengthDict) => number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWidthLimitedColumnsArray = exports.createHeaderAsRow = exports.renderTableHorizontalBorders = exports.findLenOfColumn = exports.createRow = exports.createColumFromComputedColumn = exports.createColumFromOnlyName = exports.createTableHorizontalBorders = exports.convertRawRowOptionsToStandard = exports.cellText = void 0;
const input_converter_1 = require("../internalTable/input-converter");
exports.getWidthLimitedColumnsArray = exports.createHeaderAsRow = exports.renderTableHorizontalBorders = exports.findLenOfColumn = exports.createRow = exports.createColumFromOnlyName = exports.createTableHorizontalBorders = exports.convertRawRowOptionsToStandard = exports.cellText = void 0;
const console_utils_1 = require("./console-utils");

@@ -42,7 +41,2 @@ const string_utils_1 = require("./string-utils");

exports.createColumFromOnlyName = createColumFromOnlyName;
const createColumFromComputedColumn = (column) => {
var _a;
return (Object.assign(Object.assign(Object.assign(Object.assign({ name: column.name, title: (_a = column.title) !== null && _a !== void 0 ? _a : column.name }, (0, input_converter_1.objIfExists)('color', column.color)), (0, input_converter_1.objIfExists)('maxLen', column.maxLen)), (0, input_converter_1.objIfExists)('minLen', column.minLen)), { alignment: column.alignment || table_constants_1.DEFAULT_ROW_ALIGNMENT }));
};
exports.createColumFromComputedColumn = createColumFromComputedColumn;
const createRow = (color, text, separator) => ({

@@ -49,0 +43,0 @@ color,

{
"name": "console-table-printer",
"version": "2.14.0",
"version": "2.14.1",
"repository": "github:console-table-printer/console-table-printer",

@@ -13,2 +13,3 @@ "description": "Printing pretty tables on console log",

"test": "jest --config jestconfig.json",
"test:coverage": "jest --config jestconfig.json --coverage",
"lint": "eslint --ext=js,ts .",

@@ -15,0 +16,0 @@ "semantic-release": "semantic-release"

@@ -10,3 +10,2 @@ <h1 align="center">console-table-printer</h1>

## Synopsis

@@ -13,0 +12,0 @@