Socket
Socket
Sign inDemoInstall

cli-columns

Package Overview
Dependencies
5
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-columns

Columnated lists for the CLI.


Version published
Weekly downloads
577K
decreased by-18.23%
Maintainers
1
Install size
80.8 kB
Created
Weekly downloads
 

Readme

Source

cli-columns

NPM version Downloads

Columnated lists for the CLI. Unicode and ANSI safe.

Install

$ npm install --save cli-columns

Usage

const columns = require('cli-columns');
const chalk = require('chalk');

const values = [
    'blue' + chalk.bgBlue('berry'),
    '笔菠萝' + chalk.yellow('苹果笔'),
    chalk.red('apple'), 'pomegranate',
    'durian', chalk.green('star fruit'),
    'パイナップル', 'apricot', 'banana',
    'pineapple', chalk.bgRed.yellow('orange')
];

console.log(columns(values));
screenshot

API

columns(values [, options]): String

  • values {Array<String>} Array of strings to display.
  • options {Object}
    • character {String} (default: ' ') Padding character.
    • newline {String} (default: '\n') Newline character.
    • padding {Number} (default: 2) Space between columns.
    • sort {Boolean} (default: true) Whether to sort results.
    • width {Number} (default: process.stdout.columns) Max width of list.

Sorts and formats a list of values into columns suitable to display in a given width.

Contribute

Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.

Test

$ npm test

MIT © Shannon Moeller

Keywords

FAQs

Last updated on 23 Sep 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc