SkillAgentSearch skills...

Showify

Arguably the most comprehensive library for stringifying any JavaScript value into a human-readable format, handling nearly every scenario you might encounter.

Install / Use

/learn @Snowflyt/Showify

README

<h1 align="center">showify</h1> <p align="center"> Arguably the <strong><i>most comprehensive</i></strong> cross-platform library for <strong>stringifying</strong> <i>any</i> JavaScript value into a human-readable format, handling nearly every scenario you might encounter. </p> <p align="center"> <a href="https://www.npmjs.com/package/showify"> <img src="https://img.shields.io/npm/dm/showify.svg" alt="downloads" height="18"> </a> <a href="https://www.npmjs.com/package/showify"> <img src="https://img.shields.io/npm/v/showify.svg" alt="npm version" height="18"> </a> <a href="https://bundlephobia.com/package/showify"> <img src="https://img.shields.io/bundlephobia/minzip/showify.svg" alt="minzipped size" height="18"> </a> <a href="https://coveralls.io/github/Snowflyt/showify?branch=main"> <img src="https://coveralls.io/repos/github/Snowflyt/showify/badge.svg?branch=main" alt="coverage status" height="18"> </a> <a href="https://github.com/Snowflyt/showify"> <img src="https://img.shields.io/npm/l/showify.svg" alt="MPL 2.0 license" height="18"> </a> </p>

screenshot

Features

  • Stringify any JavaScript value in a format similar to util.inspect in Node.js. Special cases like Map, Set, array empty slots, wrapper objects for primitives, ArrayBuffer, DataView, WeakMap, WeakSet, and more are handled properly.
  • Support for maximum recursion depth in nested objects.
  • Circular references displayed with a reference pointer (e.g., <ref *1> { foo: { bar: [Circular *1] } }) instead of just [Circular].
  • Auto indentation and line breaking for long outputs, just like console.log/util.inspect in Node.js and Deno.
  • ANSI color support.
  • Highly customizable options for indentation, quote style, hidden properties, colors, and more.
  • Custom serializers for your own types, with a user-friendly API that works on a tree-like structure instead of raw strings, handling maximum recursion depth, indentation, and circular references automatically — without any extra effort.

Quickstart

Simply import the show function and use it to stringify any JavaScript value:

import { show } from "showify";

const value = {
  foo: "bar",
  "Hello\nworld": [-0, 2n, NaN],
  [Symbol("qux")]: { quux: "corge" },
  map: new Map([
    ["foo", "bar"],
    [{ bar: 42 }, "qux"],
  ]),
};
value.circular = value;

console.log(show(value, { indent: 2, trailingComma: "auto", colors: true }));
// <ref *1> {
//   foo: "bar",
//   "Hello\nworld": [-0, 2n, NaN],
//   map: Map(2) { "foo" => "bar", { bar: 42 } => "qux" },
//   circular: [Circular *1],
//   Symbol(qux): { quux: "corge" },
// }

The show() function accepts an optional second argument for options. Some common options are listed here:

  • depth: Maximum recursion depth, defaults to Infinity.
  • indent: Number of spaces to indent, defaults to 0. To enable indentation and auto line breaking, set indent to a positive integer, e.g., 2.
  • breakLength: Maximum line length before breaking, defaults to 80. This option is ignored if indent is 0.
  • sorted: Whether to sort the keys of objects (including Maps and Sets) in the resulting string, defaults to false.
  • quoteStyle: Preferred quote style for strings, should be "single", "double", "backtick", or an array of them to try in order, defaults to ["double", "single", "backtick"].
  • trailComma: Whether to add a trailing comma to the last element of an array or object, should be "none", "always" or "auto" (add trailing comma only when the last item is on a separate line), defaults to "none".
  • colors: Enable ANSI colors, defaults to false.

showify supports many other options. For a complete list of options, see the available options section below.

Note that showify uses slightly different default options compared to util.inspect in Node.js. If you want to achieve the exactly same default output as util.inspect in Node.js, see the related FAQ.

Installation

To install showify via npm (or any other package manager you prefer):

npm install showify

If you prefer a lightweight version with a smaller bundle size, you may also consider @showify/lite, which removes ANSI color support and several other features that are not needed for most use cases.

Comparison

Here’s a comparison of the features of showify, util.inspect in Node.js, and other libraries:

  • ✅ 1st-class, built-in, and ready to use with no additional configuration or code.
  • 🟡 Supported, but has limitations or is not as complete as showify.
  • 🔶 Supported and documented, but not out-of-the-box or requires extra user-code to implement.
  • ❌ Not officially supported or documented.

| Feature | showify | util.inspect | pretty-format | object-inspect | stringify-object | | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Bundle size | <a href="https://bundlephobia.com/package/showify"><img src="https://img.shields.io/bundlephobia/minzip/showify.svg" alt="minzipped size" height="18"></a> | ❓ | <a href="https://bundlephobia.com/package/pretty-format"><img src="https://img.shields.io/bundlephobia/minzip/pretty-format.svg" alt="minzipped size" height="18"></a> | <a href="https://bundlephobia.com/package/object-inspect"><img src="https://img.shields.io/bundlephobia/minzip/object-inspect.svg" alt="minzipped size" height="18"></a> | <a href="https://bundlephobia.com/package/stringify-object"><img src="https://img.shields.io/bundlephobia/minzip/stringify-object.svg" alt="minzipped size" height="18"></a> | | Indentation | ✅ | 🟡 uncustomizable | ✅ | ✅ | ✅ | | Auto line breaking | ✅ | ✅ | ❌ | ❌ | ❌ | | Array elements grouping [1] | ✅ | ✅ | ❌ | ❌ | ❌ | | Circular references | ✅ | ✅ | ✅ | ✅ | ✅

View on GitHub
GitHub Stars109
CategoryDevelopment
Updated4d ago
Forks2

Languages

TypeScript

Security Score

100/100

Audited on Mar 28, 2026

No findings