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

as-table

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-table

A simple function that print objects / arrays as ASCII tables. Handles ANSI styling and weird 💩 Unicode emoji symbols – they won't break the layout.

  • 1.0.55
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by7.76%
Maintainers
2
Weekly downloads
 
Created

What is as-table?

The 'as-table' npm package is a simple utility for formatting arrays of objects into a readable table format. It is particularly useful for displaying tabular data in a console or terminal environment.

What are as-table's main functionalities?

Basic Table Formatting

This feature allows you to format an array of objects into a readable table. The code sample demonstrates how to use 'as-table' to display a list of people with their names and ages in a tabular format.

const asTable = require('as-table');
const data = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
  { name: 'Charlie', age: 35 }
];
console.log(asTable(data));

Custom Column Formatting

This feature allows you to customize the formatting of specific columns. The code sample shows how to append 'years' to the age column values.

const asTable = require('as-table');
const data = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
  { name: 'Charlie', age: 35 }
];
const options = {
  age: x => x + ' years'
};
console.log(asTable.configure(options)(data));

Column Alignment

This feature allows you to align the content of specific columns. The code sample demonstrates how to right-align the age column.

const asTable = require('as-table');
const data = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
  { name: 'Charlie', age: 35 }
];
const options = {
  align: { age: 'right' }
};
console.log(asTable.configure(options)(data));

Other packages similar to as-table

Keywords

FAQs

Package last updated on 12 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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