module.exports = function formOpt(opts) { const result = { id: 0, awards: [], } const colors = ['#17BEBB', '#2E282A', '#CD5334'] const colorNum = opts.length % 2 === 1 ? 3 : 2 opts.map((item, index) => { result.awards.push({ name: item.title, content: item.content, color: colors[index % colorNum], idx: index, }) }) return result }