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

pretty-print

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-print

Print formatted data to the the command line

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
358
decreased by-91.27%
Maintainers
1
Weekly downloads
 
Created
Source

pretty-print

Print formatted data to the the command line.

Install

npm install pretty-print --save

Usage

###Object

Options

  • leftPadding - extra padding before the object key. Defaults to 2.
  • rightPadding - extra padding after the object key. Defaults to 2.
var print = require('pretty-print');
var options = {
  leftPadding: 2,
  rightPadding: 3
};

print({
  key: 'value'
  longerKey: 'value'
}, options);

// outputs
//
//   key        value
//   longerKey  value

Array of objects

Options

  • leftPadding - extra padding before the object key. Defaults to 2.
  • rightPadding - extra padding after the object key. Defaults to 2.
  • key - name of the value to use as the list key
  • value - name of value to use as the list value
var print = require('pretty-print');
var options = {
  rightPadding: 3,
  key: 'name',
  value: 'height'
};

print([
  {
    name: 'guy',
    height: 'short',
  },
  {
    name: 'girl',
    height: 'short'
  }
], options);

// outputs:
//
// guy:   short
// girl:  short

Array of strings or numbers

var print = require('pretty-print');

print(['val1', 'val2', 'val3'], {leftPadding: 0});

// outputs:
//
//  val1
//  val2
//  val3

Keywords

FAQs

Package last updated on 07 Feb 2014

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