Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@sinonjs/formatio
Advanced tools
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.
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 }));
pretty-format is a package developed by Facebook as part of the Jest testing framework. It offers similar functionality to @sinonjs/formatio by providing a way to serialize JavaScript objects into strings for snapshot testing. It supports plugins to handle different types of objects and is more extensible compared to @sinonjs/formatio.
util-inspect is a node module that provides an inspection function similar to Node.js core's util.inspect method. It is used for converting objects into strings for debugging purposes. While it shares similar basic functionality with @sinonjs/formatio, it is more tightly integrated with Node.js's core modules and might offer better performance in a Node.js environment.
This package has been deprecated and will receive no further maintenance.
If you need this package, please fork it and maintain it yourself.
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).
npm install @sinonjs/formatio
https://sinonjs.github.io/formatio/
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
formatio was released under BSD-3
FAQs
Human-readable object formatting
We found that @sinonjs/formatio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.