(name: string)
| 964 | // - DO NOT add "var-" for numeric-leading names (e.g., "--05" is valid) |
| 965 | // - collapse accidental extra dashes (e.g. var(----foo) -> "--foo") |
| 966 | export function normalizeCustomPropertyBody(name: string): string { |
| 967 | if (!name) return 'var' |
| 968 | let raw = name.trim() |
| 969 | if (raw.startsWith('--')) raw = raw.slice(2) |
| 970 | raw = raw.replace(/^-+/, '') |
| 971 | // Remove unsupported characters (Figma's CSS output tends to drop punctuation) |
| 972 | raw = raw.replace(/[^A-Za-z0-9_-]/g, '') |
| 973 | return raw || 'var' |
| 974 | } |
| 975 | |
| 976 | export function normalizeCustomPropertyName(name: string): string { |
| 977 | return `--${normalizeCustomPropertyBody(name)}` |
no outgoing calls
no test coverage detected