MCPcopy Create free account
hub / github.com/PicoCreator/smol-dev-js / standardTableRow

Method standardTableRow

src/cli/OutputHandler.js:650–678  ·  view source on GitHub ↗

* Standard output log, in a row format, this is used together with standardHeader * * This is enabled if either standard, or table mode is enabled * * @param {Array } dataArray * @param {Array } widthArray

(dataArray, widthArray = [])

Source from the content-addressed store, hash-verified

648 * @param {Array<Int>} widthArray
649 */
650 standardTableRow(dataArray, widthArray = []) {
651 // Does nothing if not enabled
652 if(!(this.stdOutput || this.tableOutput)) {
653 return;
654 }
655
656 // The row to output
657 let rowLine = "";
658
659 // Lets iterate the values
660 for(let k=0; k<dataArray.length; ++k) {
661 // Lets add the end padding
662 if( k>0 ) {
663 rowLine += " ";
664 }
665
666 // Handle length
667 let collumnLength = widthArray[k];
668 if( collumnLength < 0 ) {
669 collumnLength = dataArray[k].length;
670 }
671
672 // Table line content
673 rowLine += fixedWidthString( dataArray[k], collumnLength );
674 }
675
676 // Output the line
677 console.log( rowLine );
678 }
679
680 //--------------
681 // JSON output

Callers 2

tableRowMethod · 0.95
standardTableHeaderMethod · 0.95

Calls 1

fixedWidthStringFunction · 0.85

Tested by

no test coverage detected