/** * Debounce utility function * Delays the execution of a function until a specified time has passed since the last call * * @param {Function} func - The function to debounce * @param {number} wait - The delay in milliseconds * @returns {Function} - The debounced function */ export function debounce(func, wait) { let timeout; return function executedFunction(...args) { const later = () => { clearTimeout(timeout); func(...args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; }