All Projects → bahmutov → Console.table

bahmutov / Console.table

Licence: mit
Adds console.table method that prints an array of objects as a table in console

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Console.table

Libfort
C/C++ library to create formatted ASCII tables for console applications
Stars: ✭ 255 (+104%)
Mutual labels:  console, table
ctable
C library to print nicely formatted tables
Stars: ✭ 13 (-89.6%)
Mutual labels:  console, table
Criterion
Microbenchmarking for Modern C++
Stars: ✭ 140 (+12%)
Mutual labels:  console, table
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (+448%)
Mutual labels:  console, table
Ka Table
Lightweight MIT React Table component for both TS and JS with Sorting, Filtering, Grouping, Virtualization, Editing and many more
Stars: ✭ 117 (-6.4%)
Mutual labels:  table
Localappveyor
Run your AppVeyor builds, locally
Stars: ✭ 112 (-10.4%)
Mutual labels:  console
Console Logging
Better, prettier commandline logging for Python--with colors! 👻
Stars: ✭ 111 (-11.2%)
Mutual labels:  console
Complexgrid
复杂表格,支持表格展示,树形表格展示,对表格进行拖拽排序,以及表格排序,表格拖拽排序,自定义表格内容,是一个基于vue的表格插件。Complex table, support table display, tree table display, drag and drop table sort, and table sort, table drag and drop sort, custom table content, is a vue based table plugin
Stars: ✭ 110 (-12%)
Mutual labels:  table
Tty Pie
Draw pie charts in your terminal window
Stars: ✭ 125 (+0%)
Mutual labels:  console
Nload
Real-time network traffic monitor
Stars: ✭ 121 (-3.2%)
Mutual labels:  console
Eruda
Console for mobile browsers
Stars: ✭ 11,547 (+9137.6%)
Mutual labels:  console
Vue Grid
A flexible grid component for Vue.js
Stars: ✭ 113 (-9.6%)
Mutual labels:  table
Table2excel.js
Export html table to excel file in browser
Stars: ✭ 118 (-5.6%)
Mutual labels:  table
Reactables
GigaTables is a ReactJS plug-in to help web-developers process table-data in applications and CMS, CRM, ERP or similar systems.
Stars: ✭ 112 (-10.4%)
Mutual labels:  table
Jdetects
Detect if DevTools is open
Stars: ✭ 123 (-1.6%)
Mutual labels:  console
Beautifultable
Python package for printing visually appealing tables on a terminal.
Stars: ✭ 110 (-12%)
Mutual labels:  table
Xterm.js
A terminal for the web
Stars: ✭ 12,019 (+9515.2%)
Mutual labels:  console
Ng2 Smart Table
Angular Smart Data Table component
Stars: ✭ 1,590 (+1172%)
Mutual labels:  table
Rainbow
Delightful console output for Swift developers.
Stars: ✭ 1,606 (+1184.8%)
Mutual labels:  console
Hot Table
Handsontable - Best Data Grid Web Component with Spreadsheet Look and Feel.
Stars: ✭ 114 (-8.8%)
Mutual labels:  table

console.table

Adds console.table method for convenience

NPM

Build status dependencies devdependencies semantic-release

Install

npm install console.table --save
bower install console.table --save

Use in Node

// call once somewhere in the beginning of the app
const cTable = require('console.table');
console.table([
  {
    name: 'foo',
    age: 10
  }, {
    name: 'bar',
    age: 20
  }
]);

// prints
name  age
----  ---
foo   10
bar   20

You can pass multiple strings and arrays in a single console.table call. Each argument will be formatted and printed separately on new line

Get only table string

const table = cTable.getTable([
  {
    name: 'foo',
    age: 10
  }, {
    name: 'bar',
    age: 20
  }
]);

console.log(table);

// prints
name  age
----  ---
foo   10
bar   20

Use in browser

INCOMPLETE, PROBABLY CHROME ONLY FOR NOW

<script src="bower_components/console.table/dist/console.table.js"></script>
<script>
console.table([{name: 'foo'}, {name: 'bar'}]);
</script>

Details

Uses easy-table for printing to console.log

If first argument is a string, and a second argument is an array, prints title row

console.table('Several objects', [...]);

Several objects
---------------
name  age
----  ---
foo   10
bar   20
baz   30

Printing array with column names

You can use the given column names when printing an array of arrays. For example,

var values = [
  ['max', 20],
  ['joe', 30]
];
console.table(['name', 'age'], values);

name  age
----  ---
max   20 
joe   30

If the titles is the first item in the array, just use slice

var values = [
    ['name', 'age'],
    ['max', 20],
    ['joe', 30]
]
console.table(values[0], values.slice(1));

Small print

Author: Gleb Bahmutov © 2014

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2014 Gleb Bahmutov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].