
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
js-object-pretty-print
Advanced tools
Serializes a javascript object to a printable string. String is formatted to be used in either pure text environments, like a console log or in HTML or to create a JSON output.
Serializes a javascript object to a printable string. String is formatted to be used in a pure text environments, like a console log, as an HTML output, or to create a JSON string.
npm install js-object-pretty-print
var pretty = require('js-object-pretty-print').pretty,
foo = {
"aString": "ipsum lorem",
"aNumber": 3
"anArray": ["shoes", "socks", "shirts"],
"anObject": {
"aValue": 44,
"isValid": true
}
};
process.stdout.write(pretty(foo));
It is also possible to use a minified version of the code
...
var prettyMin = require('js0object-pretty-print/index-min.js').pretty;
...
Either the full or the minified versions render the same. Both are unit tested with Mocha and Chai
Function pretty accepts three arguments:
pretty(object, indentSize, outputTo);
Is the javascript object to serialize. If no object is present the function will return a string with an error.
Number of spaces in a one level indent. Default 4
String to determine the formatting of the output. One of "PRINT", "HTML" or "JSON". This argument is case insensitive. Default value is "PRINT"
Expected behavior
FAQs
Serializes a javascript object to a printable string. String is formatted to be used in either pure text environments, like a console log or in HTML or to create a JSON output.
The npm package js-object-pretty-print receives a total of 9,129 weekly downloads. As such, js-object-pretty-print popularity was classified as popular.
We found that js-object-pretty-print demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.