Socket
Book a DemoInstallSign in
Socket

0inspect

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

0inspect

Pretty string representation of object

0.0.2
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

👀 0inspect

NPM version

Simple utility for displaying a pretty eye-friendly colorful representation of an object for inspection purposes 👮.

Screenshot

📥 Install

npm i 0inspect

🏁 Use

const inspect = require("0inspect");
// or const { inspect, log } = require("0inspect");

const objString = inspect(someObj);
console.log(objString);

// or shorter
inspect.log(someObj);

📕 API

inspect(obj?: Any, options?: Object);

  • obj: Any: Object to inspect.
  • options: Object: Options object.
    • depth: Number: Object nesting depth. Default: 10.

inspect.log(obj?: Any, options?: Object);

  • Just a wrapper for console.log(inspect(obj, options)).

🎨 Colors

ColorMeaning
GreenTruthy Primitive
RedFalsy Primitive
CyanFull Object
YellowEmpty Object
MagentaFunction

As this is using Chalk for console colors, the color support control is automatic, but you can still override it this way:

const chalk = require("chalk"); // Chalk v4.1.2
chalk.level = 0; // No color

💡 See: chalk # chalk.level

🔣 Symbols

SymbolMeaning
Truthy Primitive
Falsy Primitive
Full Object
Empty Object
Function
ØNo Class
Value

💠 Examples

InputCategoryOutputOutput Color
1nTruthy Primitive◆ BigInt → 1Green
NaNFalsy Primitive◇ Number → NaNRed
undefinedFalsy Primitive◇ Ø → undefinedRed
{ a:"" }Full Object● Object → {1}Cyan
{}Empty Object○ Object → {}Yellow
() => ""Function◉ Function → (anonymous)()Magenta

📃 License

MIT © Ambratolm

Keywords

inspect

FAQs

Package last updated on 01 Apr 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.