adapters/terminal-adapter.js
function(header,body){
  
  //footer = [], 
  let Table = require('../src/factory.js');
  options.terminalAdapter = true;
  let t1 = Table(header, body,options);
  
  //hide cursor
  console.log('\u001b[?25l');
  
  //wipe existing if already rendered
  if(alreadyRendered){

    //move cursor up number to the top of the previous print
    //before deleting
    console.log('\u001b['+(previousHeight+3)+'A');
    
    //delete to end of terminal
    console.log('\u001b[0J');
  }
  else{
    alreadyRendered = true;
  }
  
  console.log(t1.render());
  
  //reset the previous height to the height of this output
  //for when we next clear the print
  previousHeight = t1.height;

}
function(header,body){
  
  //footer = [], 
  let Table = require('../src/factory.js');
  options.terminalAdapter = true;
  let t1 = Table(header, body,options);
  
  //hide cursor
  console.log('\u001b[?25l');
  
  //wipe existing if already rendered
  if(alreadyRendered){

    //move cursor up number to the top of the previous print
    //before deleting
    console.log('\u001b['+(previousHeight+3)+'A');
    
    //delete to end of terminal
    console.log('\u001b[0J');
  }
  else{
    alreadyRendered = true;
  }
  
  console.log(t1.render());
  
  //reset the previous height to the height of this output
  //for when we next clear the print
  previousHeight = t1.height;

}
function ( header , body ) { //footer = [],  let Table = require ( '../src/factory.js' ) ; options . terminalAdapter = true ; let t1 = Table ( header , body , options ) ; //hide cursor console . log ( '\u001b[?25l' ) ; //wipe existing if already rendered if ( alreadyRendered ) { //move cursor up number to the top of the previous print //before deleting console . log ( '\u001b[' + ( previousHeight + 3 ) + 'A' ) ; //delete to end of terminal console . log ( '\u001b[0J' ) ; } else { alreadyRendered = true ; } console . log ( t1 . render ( ) ) ; //reset the previous height to the height of this output //for when we next clear the print previousHeight = t1 . height ; }
because different dataFormats
because different dataFormats