Skip to content

Commit

Permalink
fix: improve performance of isColor detection for long text values …
Browse files Browse the repository at this point in the history
…(See #378)
  • Loading branch information
josdejong committed Jan 10, 2024
1 parent 4f8fa55 commit b1a04fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/utils/typeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export function getColorCSS(color: string): string | null {
* Returns true if a valid color, false otherwise
*/
export function isColor(value: unknown): boolean {
return typeof value === 'string' && !!getColorCSS(value)
const maxColorLength = 99
return typeof value === 'string' && value.length < maxColorLength && !!getColorCSS(value)
}

/**
Expand Down

0 comments on commit b1a04fc

Please sign in to comment.