Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Pretty print objects in real purdy colors. Allows clearer visualization of objects than you get from most pretty printers due to colors. It will also print out the complete path to an object, something that's extremely useful for debugging. Purdy will als
Print things real purdy for nodejs.
const Purdy = require('purdy');
Purdy({list: [1,2,3], string: 'some string'});
Purdy(object, [options])
Prints anything indented, and with arrays with index keys, and different types in colors such that it's very easy to get an overview of what object you're dealing with.
object
- anything, number, object, array, etc.options
- optional object with the following keys.
plain
- when true
, prints result without colors. Defaults to false
with tty, true
when not.path
- when true
, prints result with a path (To be used with Hoek.reach() or lodash.get, etc). Default: false
pathPrefix
- prefix for path. Default: //
arrayIndex
- enables index printing for arrays. Default: true
indent
- defines the number of spaces to indent. Default: 4
align
- determines how to align object keys. Default: left
depth
- tells purdy how many times to recurse while formatting the object. This is useful for viewing complicated objects. Default: 2
. Set to null
to recurse indefinitelyproto
- include the prototype chain and print all inherited properties as well. Default: false
json
- attempt to parse strings beginning with { as JSON. Default: false
Purdy.stringify(object, [options])
This function returns a string without printing it to stdout. This may prove to be useful for log files other other applications.
const purdyString = Purdy.stringify({a: 'b'}, {plain: true});
writeLog(purdyString);
Purdy.purdy([options]);
Useful if you want to print multiple objects like console.log
const purdy = Purdy.purdy({plain: true});
purdy.print('one', 'two');
purdy.stringify('one', 'two');
The following code prints what's in the image above.
const mises = function mises () { this.moop = 3 }
const instance = new mises();
const circularObj = { };
circularObj.a = circularObj;
const obj = {
integer: Date.now(),
string: 'foo',
anonPurdy: Purdy,
defined: function Yes() {},
nested: {hello: 'hapi'},
error: new Error('bad'),
null: null,
undefined: undefined,
regexp: new RegExp,
falseBool: false,
trueBool: true,
symbol: Symbol('purdy'),
emptyArr: [],
circular: circularObj,
date: new Date(),
arrayWithVisibleIndex: [ 'one', 'two', 'three' ],
instance: instance,
};
Purdy(obj);
This package also installs the purdy
CLI tool. Right now this just prints
any JSON file with default options.
purdy package.json
will, for example, print the JSON contents of
package.json.
Similarly, cat package.json | purdy -s
will use stdin to print the contents.
A new option -l
has been added to parse log files for newline delimited JSON (NDJSON).
purdy -l logfile.log
will print that or cat app.log | purdy -l -s
This project adheres to the hapi styleguide.
FAQs
Pretty print objects in real purdy colors. Allows clearer visualization of objects than you get from most pretty printers due to colors. It will also print out the complete path to an object, something that's extremely useful for debugging. Purdy will als
We found that purdy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.