Socket
Socket
Sign inDemoInstall

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 2.5.7 to 2.5.8

19

examples/styles-and-formatting.js

@@ -127,1 +127,20 @@ var Table = require('../');

console.log(str2);
//template literals
let header3 = [
{ value: 'name', width: 30, headerAlign: 'left' },
{ value: 'price', width: 30, headerAlign: 'left' }
];
const opts = {
align: 'left'
};
const data = [
[`apple ${chalk.red("mac")}`,92.50],
["ibm",120.15]
]
let t3 = Table(header3,data, opts);
console.log(t3.render());

49

examples/wide-characters.js

@@ -35,19 +35,32 @@ var Table = require('../');

//var rows = [
// "abc",
// "abć",
// "ab한"
//];
//
//var t2 = Table(header,rows,{
// borderStyle : 2,
// paddingBottom : 0,
// paddingLeft: 2,
// paddingRight: 2,
// headerAlign : "right",
// align : "center",
// color : "white"
//});
//
//str2 = t2.render();
//console.log(str2);
var header2 = [
{
value : "项目",
},
{
value : "价格",
},
{
value : "有机",
}
];
var rows2 = [
["abc"],
["abć"],
["ab한"]
];
var t2 = Table(header2,rows2,{
borderStyle : 2,
paddingBottom : 0,
paddingLeft: 2,
paddingRight: 2,
headerAlign : "right",
align : "center",
color : "white"
});
str2 = t2.render();
console.log(str2);
{
"name": "tty-table",
"version": "2.5.7",
"version": "2.5.8",
"description": "Command line table generator.",

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

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

//let StripAnsi = require("strip-ansi");
let StripAnsi = require("strip-ansi");
//let Wrap = require("word-wrap");

@@ -9,3 +9,3 @@ let Wrap = require("smartwrap");

//return StripAnsi(line.replace(/[^\x00-\xff]/g,'XX')).length;
return Wcwidth(line);
return Wcwidth(StripAnsi(line));
}

@@ -84,3 +84,4 @@

//string has wide characters
case(string.length < Format.calculateLength(string)):
case(/[\uD800-\uDFFF]/.test(string)):
//case(string.length < Format.calculateLength(string)):
string = Format.handleWideChars(

@@ -87,0 +88,0 @@ string,

@@ -39,1 +39,9 @@

└──────────────────────────────┴──────────┴───────────────┘
┌──────────────────────────────┬──────────┬───────────────┐
│ name │ price │ │
├──────────────────────────────┼──────────┼───────────────┤
│ apple mac │ 92.5 │ ? │
├──────────────────────────────┼──────────┼───────────────┤
│ ibm │ 120.15 │ ? │
└──────────────────────────────┴──────────┴───────────────┘
┌───────────────────────────┬──────┬─────┐
│ 项目 │ 价格 │ 有 │
│ │ │ 机 │
├───────────────────────────┼──────┼─────┤

@@ -15,3 +16,15 @@ │ 汉堡包 │ 2.5 │ ? │

├───────────────────────────┼──────┼─────┤
│ 意大利粉, 火腿, 意大利干 │ 3.75 │ no │
│ 意大利粉, 火腿, │ 3.75 │ no │
│ 意大利干酪 │ │ │
└───────────────────────────┴──────┴─────┘
+---------------------------+------+-----+
| 项目 | 价 | 有 |
| | 格 | 机 |
+---------------------------+------+-----+
| abc | ? | ? |
+---------------------------+------+-----+
| abć | ? | ? |
+---------------------------+------+-----+
| ab한 | ? | ? |
+---------------------------+------+-----+
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc