Issue
I'm running javascript with node.js and looking at the console.logs through Putty.
How can I get the terminal in ssh to show me things with the tabs inline? I see two tab spaces but the string following is out of place depending on how long the first string is.
console.log('short'+'\t\t'+'valueA');
console.log('looooooong'+'\t\t'+valueH);
I might get something like this
short valueA
looooooong valueH
whereas for readability it would be much nicer to see
short valueA
looooooong valueH
Solution
There's a module to handle this scenario, called tab. You could do:
var mod_tab = require('tab');
mod_tab.emitTable({
'columns': [{
'align': 'left',
'width': 12
}, {
'align': 'right',
'width': 10
}],
'omitHeader': true,
'rows': [
['short', 'valueA'],
['looooooooong', 'valueH']
]
});
It has some interesting features, that you could check out by reading the docs.
Answered By - Rodrigo Medeiros