fix(module): omit colors defined as strings

This commit is contained in:
Benjamin Canac
2023-07-30 20:04:04 +02:00
parent cefe5a76e0
commit 927b63fa2e

View File

@@ -191,7 +191,11 @@ const safelistComponentAliasesMap = {
const colorsAsRegex = (colors: string[]): string => colors.join('|')
export const excludeColors = (colors: object) => Object.keys(omit(colors, colorsToExclude)).map(color => kebabCase(color)) as string[]
export const excludeColors = (colors: object): string[] => {
return Object.entries(omit(colors, colorsToExclude))
.filter(([, value]) => typeof value === 'object')
.map(([key]) => kebabCase(key))
}
export const generateSafelist = (colors: string[], globalColors) => {
const baseSafelist = Object.keys(safelistByComponent).flatMap(component => safelistByComponent[component](colorsAsRegex(colors)))