export default function ifUnmodified(fn: (...args: unknown[]) => unknown) {
  return function (...args: unknown[]) {
    if (args[0] instanceof KeyboardEvent) {
      const event = args[0]

      if (
        !event.ctrlKey &&
        !event.shiftKey &&
        !event.altKey &&
        !event.metaKey
      ) {
        fn.apply(event.target, args)
      }
    }
  }
}
