Socket
Socket
Sign inDemoInstall

@sinonjs/formatio

Package Overview
Dependencies
4
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sinonjs/formatio

Human-readable object formatting


Version published
Maintainers
5
Install size
246 kB
Created

Package description

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

Changelog

Source

4.0.1

  • 8dae99e Fix changes.md (Morgan Roderick)
  • 8dde8cb Use '--access public' for the publish command (Morgan Roderick)

Released on 2019-12-19.

Readme

Source

formatio

Build status codecov

The cheesy object formatter

Pretty formatting of arbitrary JavaScript values. Currently only supports ascii formatting, suitable for command-line utilities. Like JSON.stringify, it formats objects recursively, but unlike JSON.stringify, it can handle regular expressions, functions, circular objects and more.

formatio is a general-purpose library. It works in browsers (including old and rowdy ones, like IE6) and Node. It will define itself as an AMD module if you want it to (i.e. if there's a define function available).

Installation

npm install @sinonjs/formatio

Documentation

https://sinonjs.github.io/formatio/

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]

Licence

formatio was released under BSD-3

FAQs

Last updated on 19 Dec 2019

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc