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.1 to 0.0.2

19

index.js

@@ -7,4 +7,9 @@ var asciitable = module.exports = function asciitable(options, data) {

if (typeof options === "object" && Array.isArray(options) && typeof data === "undefined") {
if (typeof options === "object" && Array.isArray(options)) {
var tmp = data;
data = options;
options = tmp;
}
if (!options) {
options = {};

@@ -40,17 +45,15 @@ }

var total_width = columns.reduce(function(i, v) {
return i + v.width + 3;
}, 4);
var output = [];
output.push((new Array(total_width)).join("-"));
var separator = [""].concat(columns.map(function(e) { return (new Array(e.width + 1)).join("-"); })).concat([""]).join(options.plusIntersections ? "-+-" : "---");
output.push(separator);
output.push([""].concat(columns.map(function(e) { return pad(e.field, e.width); })).concat([""]).join(" | "));
output.push((new Array(total_width)).join("-"));
output.push(separator);
data.forEach(function(row) {
output.push([""].concat(columns.map(function(column) { return pad(row[column.field], column.width); })).concat([""]).join(" | "));
});
output.push((new Array(total_width)).join("-"));
output.push(separator);
return output.join("\n");
};
{
"name": "asciitable",
"version": "0.0.1",
"version": "0.0.2",
"description": "Render tables in text for tabular terminal fun times!",

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

@@ -32,3 +32,11 @@ asciitable

```javascript
var table = asciitable([options], data);
var table = asciitable(options, data);
// OR
var table = asciitable(data, options);
// OR
var table = asciitable(data);
```

@@ -59,2 +67,4 @@

array.
* _plusIntersections_ - enables using a `+` character at line intersections.
Default is false. Or undefined. Whatever, default is "not enabled".

@@ -61,0 +71,0 @@ Example

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