const github = function (data) { const noun = "commit" + data.commits.length > 1?"s":""; var text = data.commits.reduce((acc, curr, index) => { if (index < 6) { acc += `${curr.id.slice(0,6)}: ` + `${curr.message}\n`; } return acc; }, `🔨 ${data.commits.length} ${noun}\n`); if (data.commits.length > 6) { text += `${data.commits.length - 6} more ${noun}.`; } return text; }; const gitlab = github; module.exports = { github, gitlab };