npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

console-tools-js

v1.6.1

Published

JavaScript/TypeScript console tools

Downloads

7

Readme

console-tools-js

JavaScript/TypeScript execution utilities for text formatting.

npm version ESLint Prettier Vitest

Installation

npm install console-tools-js

Usage

Text Formatting

import { formatText, FontColor, BackgroundColor } from 'console-tools-js';

// Format text with various styles
const boldRedText = formatText('Important message', { 
  bold: true, 
  fontColor: FontColor.RED 
});

// Format text with background color
const highlightedText = formatText('Warning', {
  backgroundColor: BackgroundColor.RED,
  fontColor: FontColor.BLACK
});

// Combine multiple styles
const emphasisText = formatText('Critical alert', {
  bold: true,
  italic: true,
  underline: true,
  fontColor: FontColor.RED
});

console.log(boldRedText);
console.log(highlightedText);
console.log(emphasisText);

Console Tables

import { createTable, TableColumn, FontColor } from 'console-tools-js';

// Sample data
const data = [
  { id: 1, name: 'Alice', status: 'active' },
  { id: 2, name: 'Bob', status: 'inactive' },
  { id: 3, name: 'Charlie', status: 'pending' }
];

// Define columns
const columns: TableColumn[] = [
  { header: 'ID', key: 'id' },
  { header: 'Name', key: 'name' },
  { header: 'Status', key: 'status', color: FontColor.GREEN }
];

// Create a basic table
const basicTable = createTable(data, columns);
console.log(basicTable);

// Create a table with borders and custom header color
const fancyTable = createTable(data, columns, {
  border: true,
  headerColor: FontColor.CYAN,
  padding: 3
});
console.log(fancyTable);

API Documentation

Text Formatting

formatText(text: string, style: FontStyle): string

Formats text with ANSI escape sequences for terminal styling.

  • Parameters:
    • text - The text to format
    • style - An object containing formatting options
  • Returns: The formatted text string with ANSI escape codes

FontStyle type

type FontStyle = {
  bold?: boolean
  italic?: boolean
  underline?: boolean
  fontColor?: FontColor
  backgroundColor?: BackgroundColor
  strikethrough?: boolean
}

FontColor enum

enum FontColor {
  BLACK = '30',
  RED = '31',
  GREEN = '32',
  YELLOW = '33',
  BLUE = '34',
  MAGENTA = '35',
  CYAN = '36',
  WHITE = '37',
  // ...and more bright variants
}

BackgroundColor enum

enum BackgroundColor {
  BLACK = '40',
  RED = '41',
  GREEN = '42',
  YELLOW = '43',
  BLUE = '44',
  MAGENTA = '45',
  CYAN = '46',
  WHITE = '47',
  // ...and more bright variants
}

Console Tables

createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableOptions): string

Creates a formatted table for console output.

  • Parameters:
    • data - Array of objects containing the data to display
    • columns - Column configuration with header text, data key, and optional color
    • options - Table display options (optional)
  • Returns: A formatted table string ready for console output

TableColumn interface

interface TableColumn {
  header: string;      // Column header text
  key: string;         // Property name in data objects
  color?: FontColor;   // Optional color for column values
  width?: number;      // Optional explicit column width
}

TableOptions interface

interface TableOptions {
  headerColor?: FontColor;  // Color for all headers
  padding?: number;         // Padding between columns
  border?: boolean;         // Whether to draw table borders
}