@warriorjs/cli
Version:
WarriorJS command line
31 lines (25 loc) • 909 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _printLine = require('./printLine');
var _printLine2 = _interopRequireDefault(_printLine);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Prints the total score as the sum of the current score and the addition.
*
* If the current score is zero, just the addition and not the sum will be
* printed.
*
* @param {number} currentScore The current score.
* @param {number} addition The score to add to the current score.
*/
function printTotalScore(currentScore, addition) {
if (currentScore === 0) {
(0, _printLine2.default)(`Total Score: ${addition.toString()}`);
} else {
(0, _printLine2.default)(`Total Score: ${currentScore} + ${addition} = ${currentScore + addition}`);
}
}
exports.default = printTotalScore;
module.exports = exports.default;
;