functional not if then else code example
Example: functional not if then else
//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);