Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
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 extremly useful for debugging. Purdy will also
Print things real purdy for nodejs.
var 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())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
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.
var purdyString = Purdy.stringify({a: 'b'}, {plain: true});
writeLog(purdyString);
var Purdy = require('purdy');
var circularObj = { };
circularObj.a = circularObj;
Purdy({
integer: Date.now(),
string: 'foo',
anonymous: Purdy,
defined: function Yes() {},
nested: {hello: 'hapi'},
error: new Error('bad'),
null: null,
undefined: undefined,
regexp: new RegExp,
falseBool: false,
trueBool: true,
emptyArr: [],
circular: circularObj,
date: new Date(),
arrayWithVisibleIndex: [ 'one', 'two', 'three' ]
});
// var obj = {
// travel: {
// down: {
// a: [{
// path: 'to get here'
// }]
// }
// }
// Purdy(obj, { path: true });
{
travel: {
// travel.down
down: {
// travel.down.a
a: [
// travel.down.a.0
[0] {
// travel.down.a.0.path
path: 'to get here'
}
]
}
}
}
// var Hoek = require('hoek');
// Purdy(Hoek.reach(obj, 'travel.down.a.0.path'));
{
path: 'to get here'
}
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 -
will use stdin to print the contents.
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
The npm package purdy receives a total of 3,542 weekly downloads. As such, purdy popularity was classified as popular.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.