Socket
Socket
Sign inDemoInstall

console.table

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console.table - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

33

dist/console.table.js

@@ -12,2 +12,16 @@ (function () {

function isType(t, x) {
return typeof x === t;
}
var isString = isType.bind(null, 'string');
function isArrayOf(isTypeFn, a) {
return Array.isArray(a) &&
a.every(isTypeFn);
}
var isArrayOfStrings = isArrayOf.bind(null, isString);
var isArrayOfArrays = isArrayOf.bind(null, Array.isArray);
var Table = require('easy-table');

@@ -32,2 +46,14 @@

function printTableWithColumnTitles(titles, items) {
var t = new Table();
items.forEach(function (item) {
item.forEach(function (value, k) {
t.cell(titles[k], value);
});
t.newRow();
});
var str = t.toString();
console.log(str);
}
function printTitleTable(title, arr) {

@@ -73,2 +99,9 @@ var str = arrayToString(arr);

}
if (args.length === 2 &&
isArrayOfStrings(args[0]) &&
isArrayOfArrays(args[1])) {
return printTableWithColumnTitles(args[0], args[1]);
}
args.forEach(function (k) {

@@ -75,0 +108,0 @@ if (typeof k === 'string') {

2

dist/console.table.min.js

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

!function(){"use strict";function a(){function a(a){var b=new e;return a.forEach(function(a){"string"==typeof a||"number"==typeof a?b.cell("item",a):Object.keys(a).forEach(function(c){b.cell(c,a[c])}),b.newRow()}),b.toString()}function b(b,c){var d=a(c),e=d.indexOf("\n");if(e>0){b.length>e&&(e=b.length),console.log(b);var f,g="-",h="";for(f=0;e>f;f+=1)h+=g;console.log(h)}console.log(d)}function c(a){var b=Object.keys(a);return b.map(function(b){return{key:b,value:a[b]}})}function d(b){return a(c(b))}if("undefined"==typeof console)throw new Error("Weird, console object is undefined");if("function"!=typeof console.table){var e=require("easy-table");console.table=function(){var c=Array.prototype.slice.call(arguments);return 2===c.length&&"string"==typeof c[0]&&Array.isArray(c[1])?b(c[0],c[1]):void c.forEach(function(b){return"string"==typeof b?console.log(b):void(Array.isArray(b)?console.log(a(b)):"object"==typeof b&&console.log(d(b)))})}}}a()}();
!function(){"use strict";function a(){function a(a,b){return typeof b===a}function b(a,b){return Array.isArray(b)&&b.every(a)}function c(a){var b=new k;return a.forEach(function(a){"string"==typeof a||"number"==typeof a?b.cell("item",a):Object.keys(a).forEach(function(c){b.cell(c,a[c])}),b.newRow()}),b.toString()}function d(a,b){var c=new k;b.forEach(function(b){b.forEach(function(b,d){c.cell(a[d],b)}),c.newRow()});var d=c.toString();console.log(d)}function e(a,b){var d=c(b),e=d.indexOf("\n");if(e>0){a.length>e&&(e=a.length),console.log(a);var f,g="-",h="";for(f=0;e>f;f+=1)h+=g;console.log(h)}console.log(d)}function f(a){var b=Object.keys(a);return b.map(function(b){return{key:b,value:a[b]}})}function g(a){return c(f(a))}if("undefined"==typeof console)throw new Error("Weird, console object is undefined");if("function"!=typeof console.table){var h=a.bind(null,"string"),i=b.bind(null,h),j=b.bind(null,Array.isArray),k=require("easy-table");console.table=function(){var a=Array.prototype.slice.call(arguments);return 2===a.length&&"string"==typeof a[0]&&Array.isArray(a[1])?e(a[0],a[1]):2===a.length&&i(a[0])&&j(a[1])?d(a[0],a[1]):void a.forEach(function(a){return"string"==typeof a?console.log(a):void(Array.isArray(a)?console.log(c(a)):"object"==typeof a&&console.log(g(a)))})}}}a()}();

@@ -12,2 +12,16 @@ (function () {

function isType(t, x) {
return typeof x === t;
}
var isString = isType.bind(null, 'string');
function isArrayOf(isTypeFn, a) {
return Array.isArray(a) &&
a.every(isTypeFn);
}
var isArrayOfStrings = isArrayOf.bind(null, isString);
var isArrayOfArrays = isArrayOf.bind(null, Array.isArray);
var Table = require('easy-table');

@@ -32,2 +46,14 @@

function printTableWithColumnTitles(titles, items) {
var t = new Table();
items.forEach(function (item) {
item.forEach(function (value, k) {
t.cell(titles[k], value);
});
t.newRow();
});
var str = t.toString();
console.log(str);
}
function printTitleTable(title, arr) {

@@ -73,2 +99,9 @@ var str = arrayToString(arr);

}
if (args.length === 2 &&
isArrayOfStrings(args[0]) &&
isArrayOfArrays(args[1])) {
return printTableWithColumnTitles(args[0], args[1]);
}
args.forEach(function (k) {

@@ -75,0 +108,0 @@ if (typeof k === 'string') {

{
"name": "console.table",
"description": "Adds console.table method that prints an array of objects as a table in console",
"version": "0.6.0",
"version": "0.7.0",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -79,2 +79,3 @@ "bugs": {

"scripts": {
"build": "grunt",
"commit": "commit-wizard",

@@ -81,0 +82,0 @@ "demo": "node test/test.js",

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