You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@sinonjs/formatio

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinonjs/formatio

Human-readable object formatting

6.0.0
latest
Source
npmnpm
Version published
Maintainers
5
Created

What is @sinonjs/formatio?

The @sinonjs/formatio package is a utility for pretty-printing JavaScript values, particularly useful for producing human-readable output of complex objects and structures. It is often used in testing frameworks to format output for assertions and logs.

What are @sinonjs/formatio's main functionalities?

Pretty-printing objects

This feature allows the pretty-printing of objects into a string format that is easy to read, especially useful for debugging or displaying complex data structures in logs.

const formatio = require('@sinonjs/formatio');
const obj = { name: 'Alice', age: 25, details: { hobbies: ['reading', 'cycling'] } };
console.log(formatio.ascii(obj));

Custom depth for formatting

This feature enables control over how deep the formatting should go when converting objects to strings. It helps in avoiding too much verbosity by limiting the depth of object traversal.

const formatio = require('@sinonjs/formatio');
const obj = { name: 'Alice', age: 25, details: { hobbies: ['reading', 'cycling'], location: 'City' } };
console.log(formatio.ascii(obj, { maxDepth: 1 }));

Other packages similar to @sinonjs/formatio

FAQs

Package last updated on 06 Jan 2021

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