Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asciitable

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asciitable - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

21

example.js

@@ -5,8 +5,17 @@ #!/usr/bin/env node

var table = asciitable([
{ab: "a", b: "b", c: "c"},
{ab: "asddsfa", b: "sss", c: "zxc"},
{ab: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
{ab: "m", b: "n", c: "o", de: "p"},
{ab: 5, b: null, c: {}, de: []},
var options = {
columns: [
{field: "ab", name: "First"},
{field: "b", name: "Second"},
{field: "c", name: "Third"},
{field: "de", name: "Fourth"},
],
};
var table = asciitable(options, [
{ab: "a", b: "b", c: "c" },
{ab: "asddsfa", b: "sss", c: "zxc" },
{ab: "dsgvdgsdvgssdf", b: "x", c: "eryty" },
{ab: "m", b: "n", c: "o", de: "p"},
{ab: 5, b: null, c: {}, de: [] },
{ab: function(){}},

@@ -13,0 +22,0 @@ ]);

@@ -28,6 +28,12 @@ var asciitable = module.exports = function asciitable(options, data) {

columns = columns.map(function(e) {
return {
field: e,
width: e.length,
};
if (typeof e === "string") {
e = {
name: e,
field: e,
};
}
e.width = e.name.length;
return e;
});

@@ -50,3 +56,3 @@

output.push(separator);
output.push([""].concat(columns.map(function(e) { return pad(e.field, e.width); })).concat([""]).join(" | "));
output.push([""].concat(columns.map(function(e) { return pad(e.name, e.width); })).concat([""]).join(" | "));
output.push(separator);

@@ -53,0 +59,0 @@ data.forEach(function(row) {

{
"name": "asciitable",
"version": "0.0.3",
"version": "0.0.4",
"description": "Render tables in text for tabular terminal fun times!",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -77,9 +77,18 @@ asciitable

var table = asciitable([
{a: "a", b: "b", c: "c"},
{a: "asddsfa", b: "sss", c: "zxc"},
{a: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
{a: "m", b: "n", c: "o", d: "p"},
{a: 5, b: null, c: {}, d: []},
{a: function(){}},
var options = {
columns: [
{field: "ab", name: "First"},
{field: "b", name: "Second"},
{field: "c", name: "Third"},
{field: "de", name: "Fourth"},
],
};
var table = asciitable(options, [
{ab: "a", b: "b", c: "c" },
{ab: "asddsfa", b: "sss", c: "zxc" },
{ab: "dsgvdgsdvgssdf", b: "x", c: "eryty" },
{ab: "m", b: "n", c: "o", de: "p"},
{ab: 5, b: null, c: {}, de: [] },
{ab: function(){}},
]);

@@ -93,12 +102,12 @@

```
-------------------------------------------------
| a | b | c | d |
-------------------------------------------------
| a | b | c | |
| asddsfa | sss | zxc | |
| dsgvdgsdvgssdf | x | eryty | |
| m | n | o | p |
| 5 | null | [object Object] | |
| function (){} | | | |
-------------------------------------------------
--------------------------------------------------------
| First | Second | Third | Fourth |
--------------------------------------------------------
| a | b | c | |
| asddsfa | sss | zxc | |
| dsgvdgsdvgssdf | x | eryty | |
| m | n | o | p |
| 5 | null | [object Object] | |
| function (){} | | | |
--------------------------------------------------------
```

@@ -105,0 +114,0 @@

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