Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const applySingleStyle = memoize((key: string, value: string, text: string) => {
switch (key) {
case 'fontWeight':
return value === 'bold' ? colorette.bold(text) : text;
case 'fontStyle':
return value === 'italic' ? colorette.italic(text) : text;
case 'textDecoration': {
switch (value) {
case 'line-through':
return colorette.strikethrough(text);
case 'underline':
return colorette.underline(text);
default:
return text;
}
}
case 'textTransform': {
switch (value) {
case 'uppercase':
return text.toUpperCase();
case 'lowercase':
return text.toLowerCase();
case 'capitalize':
return capitalize(text);
default:
return text;