//remove if then else... OBJECT MAPPER const colors = { red: true, blue: true, 'default': false, }; //An object specifying the results const colorMapper = color => colors[color] || colors['default']; // A mapping function const color = colorMapper(item.color);