export function debounce(fn, timeout = 1000) {
  let timeoutRef = null;

  return (...args) => {
    if (timeoutRef) clearTimeout(timeoutRef);

    timeoutRef = setTimeout(() => {
      return fn(...args);
    }, timeout);
  };
}