Use array.reduce to generate color map
This commit is contained in:
parent
80af9042b0
commit
de78f1a242
|
@ -28,11 +28,10 @@
|
||||||
|
|
||||||
const updateConstraints = options => {
|
const updateConstraints = options => {
|
||||||
constraints.inclusion = options.map(option => option.name)
|
constraints.inclusion = options.map(option => option.name)
|
||||||
let newColors = {}
|
optionColors = options.reduce(
|
||||||
options.forEach(option => {
|
(colors, option) => ({ ...colors, [option.name]: option.color }),
|
||||||
newColors[option.name] = option.color
|
{}
|
||||||
})
|
)
|
||||||
optionColors = newColors
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDefaultColor = idx => {
|
const getDefaultColor = idx => {
|
||||||
|
|
Loading…
Reference in New Issue