1
0
Fork 0
mirror of synced 2024-08-23 05:51:29 +12:00

Use array.reduce to generate color map

This commit is contained in:
Andrew Kingston 2024-05-23 15:20:16 +01:00
parent 80af9042b0
commit de78f1a242

View file

@ -28,11 +28,10 @@
const updateConstraints = options => {
constraints.inclusion = options.map(option => option.name)
let newColors = {}
options.forEach(option => {
newColors[option.name] = option.color
})
optionColors = newColors
optionColors = options.reduce(
(colors, option) => ({ ...colors, [option.name]: option.color }),
{}
)
}
const getDefaultColor = idx => {