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

vibe-pretty-print

v0.1.3

Published

A smart formatting library for JSON, XML, YAML, and text with OpenAI integration

Downloads

17

Readme

vibe-pretty-print (JavaScript)

A smart JavaScript library for formatting JSON, XML, YAML, and plain text with OpenAI-powered enhancement.

Features

  • Multi-format support: JSON, XML, YAML, and plain text formatting
  • Validation: Validates JSON, XML, and YAML before formatting
  • OpenAI integration: Uses OpenAI GPT for enhanced formatting and readability
  • Color output: Provides colored output for better readability
  • Fallback handling: Gracefully falls back to standard formatting if OpenAI fails
  • Type-safe: Full TypeScript support and error handling

Installation

npm install vibe-pretty-print

Quick Start

Setup API Key (Recommended)

Export your OpenAI API key as an environment variable:

export VIBE_PP_API_KEY="your-openai-api-key-here"

Then use the library without hardcoding your API key:

import { vibePPrint } from 'vibe-pretty-print';

// Format JSON
const jsonText = '{"name":"John","age":30,"city":"New York"}';
const formattedJson = await vibePPrint(jsonText, 'json');
console.log(formattedJson);

// Format YAML
const yamlText = "name: John\nage: 30\ncity: New York";
const formattedYaml = await vibePPrint(yamlText, 'yaml');
console.log(formattedYaml);

// Format XML
const xmlText = "<person><name>John</name><age>30</age></person>";
const formattedXml = await vibePPrint(xmlText, 'xml');
console.log(formattedXml);

// Format plain text
const text = "Hello World! This is a test.";
const formattedText = await vibePPrint(text, 'text');
console.log(formattedText);

Alternative: Hardcoded API Key (Not Recommended)

import { vibePPrint } from 'vibe-pretty-print';

// Only use this approach for quick testing
const formatted = await vibePPrint(
  '{"test": "data"}', 
  'json',
  'your-openai-api-key'
);

API Reference

vibePPrint(text, formatType, apiKey?)

Parameters:

  • text (string): The content to format (JSON, XML, YAML, or plain text)
  • formatType (string): Type of content - "json", "xml", "yaml", or "text" (default: "text")
  • apiKey (string, optional): Your OpenAI API key. If not provided, will use VIBE_PP_API_KEY environment variable.

Returns:

  • Promise<string>: Pretty-printed/formatted string

Throws:

  • ValidationError: If the input format is invalid
  • OpenAIError: If OpenAI API calls fail
  • Error: If inputs are invalid

Requirements

  • Node.js 14+
  • OpenAI API key

License

MIT License - see LICENSE file for details.