lib/game-results-renderer.js
/**
     * Prints all available game results to standard output.
     */
Prints all available game results to standard output.
Prints all available game results to standard output .
render() {
        const results = this.gameResultsTracker.getAllResults()
        console.log(horizontalLine)
        console.log(chalk.bold(TextIo.padToFullWidth(this.gameResultsTexts.title)))
        TextIo.nl()
        const totalGames = Object.keys(results).reduce((acc, currVal) => acc + results[currVal], 0)
        Object.keys(results).forEach((key) => {
            const label = this.gameResultsTexts[key]
            const absoluteValue = results[key]
            const percentValue = absoluteValue / totalGames * 100
            renderItem(label, percentValue, absoluteValue)
        })
        console.log(horizontalLine)
        renderItem(this.gameResultsTexts.total, totalGames > 0 ? 100 : null, totalGames)
        TextIo.dnl()
    }
render ( ) { const results = this . gameResultsTracker . getAllResults ( ) console . log ( horizontalLine ) console . log ( chalk . bold ( TextIo . padToFullWidth ( this . gameResultsTexts . title ) ) ) TextIo . nl ( ) const totalGames = Object . keys ( results ) . reduce ( ( acc , currVal ) => acc + results [ currVal ] , 0 ) Object . keys ( results ) . forEach ( ( key ) => { const label = this . gameResultsTexts [ key ] const absoluteValue = results [ key ] const percentValue = absoluteValue / totalGames * 100 renderItem ( label , percentValue , absoluteValue ) } ) console . log ( horizontalLine ) renderItem ( this . gameResultsTexts . total , totalGames > 0 ? 100 : null , totalGames ) TextIo . dnl ( ) }
Prints all available game results to standard output.
Prints all available game results to standard output .