debounce
Delays a function until calls stop for N ms. Replaces Lodash debounce with 8 lines.
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
+3 more lines