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

@oclif/table

Package Overview
Dependencies
Maintainers
0
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/table

Display table in terminal

  • 0.1.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
155K
increased by2.07%
Maintainers
0
Weekly downloads
 
Created

What is @oclif/table?

@oclif/table is a utility for formatting and displaying tables in command-line interfaces (CLIs) built with the oclif framework. It provides a simple way to present tabular data in a readable format.

What are @oclif/table's main functionalities?

Basic Table Rendering

This feature allows you to render a basic table with specified columns and data. The code sample demonstrates how to create a table with 'Name' and 'Age' columns using the @oclif/table package.

const { table } = require('@oclif/table');

const data = [
  { name: 'John Doe', age: 30 },
  { name: 'Jane Smith', age: 25 }
];

const columns = {
  name: {
    header: 'Name'
  },
  age: {
    header: 'Age'
  }
};

table(data, { columns });

Custom Column Formatting

This feature allows for custom formatting of table columns. The code sample shows how to format the 'Name' column to be uppercase and the 'Age' column to append 'years' to the age value.

const { table } = require('@oclif/table');

const data = [
  { name: 'John Doe', age: 30 },
  { name: 'Jane Smith', age: 25 }
];

const columns = {
  name: {
    header: 'Name',
    get: row => row.name.toUpperCase()
  },
  age: {
    header: 'Age',
    get: row => `${row.age} years`
  }
};

table(data, { columns });

Sorting Table Data

This feature allows you to sort table data by a specified column. The code sample demonstrates sorting the table by the 'Age' column.

const { table } = require('@oclif/table');

const data = [
  { name: 'John Doe', age: 30 },
  { name: 'Jane Smith', age: 25 }
];

const columns = {
  name: {
    header: 'Name'
  },
  age: {
    header: 'Age'
  }
};

table(data, { columns, sort: 'age' });

Other packages similar to @oclif/table

Keywords

FAQs

Package last updated on 04 Oct 2024

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