Anki/ts/editor-toolbar/helpers.ts
2021-04-22 14:18:48 +02:00

12 lines
325 B
TypeScript

export function mergeTooltipAndShortcut(
tooltip: string | undefined,
shortcutLabel: string | undefined
): string | undefined {
return tooltip
? shortcutLabel
? `${tooltip} (${shortcutLabel})`
: tooltip
: shortcutLabel
? `(${shortcutLabel})`
: undefined;
}