Socket
Socket
Sign inDemoInstall

tty-table

Package Overview
Dependencies
6
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.8.1 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc