/**
 * @file hotKeys.ts - Utility for assembling hotkey key-combination strings compatible with the react-hotkeys-hook library.
 */

import { Key } from 'ts-key-enum';

/**
 * Assembles a string of key names that can be used in the useHotkeys hook.
 * Uses the format: "key1+key2+key3+..."
 *
 * @param modifiers Modifier keys
 * @param keys Keys which trigger a hotkey action
 * @returns Formatted hotkey string
 */
export function assembleHotKeyString(
  modifiers: Key[],
  keys: (Key | string)[]
): string {
  return (modifiers as string[]).concat(keys).join('+');
}
