Fix bug where color palette could not be empty
This commit is contained in:
parent
869d68d03b
commit
278c2031fb
2 changed files with 5 additions and 0 deletions
|
|
@ -75,3 +75,7 @@ test('it flattens deeply nested color objects', () => {
|
|||
'button-primary-focus-variant': 'orange',
|
||||
})
|
||||
})
|
||||
|
||||
test('it handles empty objects', () => {
|
||||
expect(flattenColorPalette({})).toEqual({})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const flattenColorPalette = (colors) =>
|
||||
Object.assign(
|
||||
{},
|
||||
...Object.entries(colors).flatMap(([color, values]) =>
|
||||
typeof values == 'object'
|
||||
? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue