Skip to content

Commit

Permalink
fix(module): omit colors defined as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jul 30, 2023
1 parent cefe5a7 commit 927b63f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 927b63f

Please sign in to comment.