πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

tty-table

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tty-table - npm Package Compare versions

Comparing version

to
2.8.2

46

examples/truncated-lines.js

@@ -1,5 +0,5 @@

var Chalk = require('chalk');
var Table = require('../');
const Table = require('../');
const Chalk = require('chalk');
var header = [
let header = [
{

@@ -23,3 +23,3 @@ value : "item",

//test truncation with elipsis
var t1 = Table(header,[],{
let t1 = Table(header,[],{
borderStyle : 1,

@@ -37,7 +37,7 @@ paddingBottom : 0,

var str1 = t1.render();
let str1 = t1.render();
console.log(str1);
//test truncation with spaces
var t2 = Table(header,[],{
let t2 = Table(header,[],{
borderStyle : 1,

@@ -55,7 +55,7 @@ paddingBottom : 0,

var str1 = t2.render();
console.log(str1);
let str2 = t2.render();
console.log(str2);
//test with padding
var t3 = Table(header,[],{
let t3 = Table(header,[],{
borderStyle : 1,

@@ -74,7 +74,7 @@ paddingLeft : 2,

var str1 = t3.render();
console.log(str1);
let str3 = t3.render();
console.log(str3);
//test truncation with boolean false
var t4 = Table(header,[],{
let t4 = Table(header,[],{
borderStyle : 1,

@@ -92,7 +92,7 @@ paddingBottom : 0,

var str4 = t4.render();
let str4 = t4.render();
console.log(str4);
//test truncation with boolean false
var t5 = Table(header,[],{
let t5 = Table(header,[],{
borderStyle : 1,

@@ -110,4 +110,20 @@ paddingBottom : 0,

var str5 = t5.render();
let str5 = t5.render();
console.log(str5);
let t6 = Table([
{ width: 5}, { width: 4}, { width: 5}
],[],{
truncate: '...',
paddingLeft: 0,
paddingRight: 0
});
t6.push(
["η‰ΉεˆΆηš„ι…±ζ±",0.10],
["2ηŽ‰η±³ι₯Ό, ε€§η±³ε’Œθ±†η±», ε₯Άι…ͺ",9.80,""],
["θ‹Ήζžœη‰‡",1.00,"yes"],
)
let str6 = t6.render();
console.log(str6);
{
"name": "tty-table",
"version": "2.8.1",
"version": "2.8.2",
"description": "Command line table generator.",

@@ -14,3 +14,5 @@ "main": "src/main.js",

"scripts": {
"dist": "npx grunt",
"test": "npx grunt t",
"test-save": "npx grunt st",
"lint": "./node_modules/.bin/eslint adapters/* src/*",

@@ -42,3 +44,3 @@ "lint-fix": "./node_modules/.bin/eslint adapters/* src/* --fix"

"csv": "^5.1.3",
"smartwrap": "^1.1.2",
"smartwrap": "^1.2.0",
"strip-ansi": "^5.2.0",

@@ -45,0 +47,0 @@ "wcwidth": "^1.0.1",

const StripAnsi = require("strip-ansi")
//const Wrap = require("word-wrap");
const Wrap = require("smartwrap")
const Smartwrap = require("smartwrap")
const Wcwidth = require("wcwidth")

@@ -142,9 +141,13 @@ const Format = {}

Format.handleTruncatedValue = function(string,cellOptions,innerWidth) {
let outstring = string
if(innerWidth < outstring.length) {
outstring = outstring.substring(0,innerWidth - cellOptions.truncate.length)
outstring = outstring + cellOptions.truncate
Format.handleTruncatedValue = function(string,cellOptions,maxWidth) {
const stringWidth = Wcwidth(string)
if(maxWidth < stringWidth) {
string = Smartwrap(string, {
width: maxWidth - cellOptions.truncate.length,
//@todo give use option to decide if they want to break words on wrapping
breakword: true
}).split('\n')[0]
string = string + cellOptions.truncate
}
return outstring
return string
}

@@ -173,3 +176,3 @@

Format.handleNonWideChars = function(string,cellOptions,innerWidth) {
let outstring = Wrap(string,{
let outstring = Smartwrap(string,{
width: innerWidth,

@@ -176,0 +179,0 @@ trim: true//,

@@ -32,1 +32,11 @@

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚ β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€
β”‚η‰Ή...β”‚0.1 β”‚ ? β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€
β”‚2... β”‚9.8 β”‚ β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€
β”‚θ‹Ή...β”‚ 1 β”‚ yes β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”˜

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display