Useful for debugging big objects, like webpack configuration.
- Compact and readable output
- No unnecessary quotes
- Color highlighted
- Prints the whole object or only the part you need
- Collapses huge arrays and objects (more than 30 items by default)
npm install q-i
const { print, stringify } = require('q-i');
const obj = { a: { x: 41, y: { z: 42 } } };
// Print whole object
print(obj);
console.log(stringify(obj));
/* =>
{
a: {
x: 41,
y: {
z: 42
}
}
}
*/
// Print part of an object
print(obj, 'a.y');
console.log(stringify(obj, 'a.y'));
/* =>
{
z: 42
}
*/
print(obj, { maxItems: Infinity })
print(obj, 'a.y', { maxItems: Infinity })
stringify(obj, { maxItems: Infinity })
stringify(obj, 'a.y', { maxItems: Infinity })
Collapse arrays with more than maxItems
items and objects with more than maxItems
keys.
The change log can be found on the Releases page.
Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.
Artem Sapegin and contributors.
MIT License, see the included License.md file.