Better Node.js Console Dumps with console-probe

January 25, 2018 0 Comments

Better Node.js Console Dumps with console-probe



Writing JavaScript in the Node.js environment has always felt a bit more difficult; probably because browser developer tools have become incredibly powerful, interactive, and visually appealing.  Using console.log on the client side isn't the best of experiences and obviously isn't interactive.

Though not interactive, I've found that console-probe is an improvement over console.log, providing me highlighted property types, lengths, and a nice visual tree view.

 const probe = require('console-probe') const donut = { 'id': '0001', 'type': 'donut', 'name': 'Cake', 'description': 'A small fried cake of sweetened dough, typically in the shape of a ball or ring.', 'ppu': 0.55, 'common': true, 'batters': { 'batter': [ { 'id': '1001', 'type': 'Regular' }, { 'id': '1002', 'type': 'Chocolate' }, { 'id': '1003', 'type': 'Blueberry' }, { 'id': '1004', 'type': "Devil's Food" } ] }, // ..... // Highlight nicely to console const prober = probe.get() prober(donut) 

console-probe is one of those nice, luxury utilities that can make debugging in a static environment just a bit better!

  • fetch API

    One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest, wasn't really made for what we've been using it for.  We've done well to create elegant APIs around XHR but we know we can do better.  Our effort to...

  • 5 Ways that CSS and JavaScript Interact That You May Not Know About

    CSS and JavaScript:  the lines seemingly get blurred by each browser release.  They have always done a very different job but in the end they are both front-end technologies so they need do need to work closely.  We have our .js files and our .css, but...

  • HTML5 Input Types Alternative

    As you may know, HTML5 has introduced several new input types: number, date, color, range, etc. The question is: should you start using these controls or not? As much as I want to say "Yes", I think they are not yet ready for any real life...

  • dwImageProtector Plugin for jQuery

    I've always been curious about the jQuery JavaScript library. jQuery has captured the hearts of web designers and developers everywhere and I've always wondered why. I've been told it's easy, which is probably why designers were so quick to adopt it NOT that designers...

Tag cloud