// @ts-ignore export * from 'lodash'; export const debounce = (fn: Function, time: number): Function => { let timeoutId; function cancel() { if (timeoutId) { clearTimeout(timeoutId); } } function wrapper(...args) { cancel(); timeoutId = setTimeout(() => { timeoutId = null; fn(...args); }, time); } wrapper.cancel = cancel; return wrapper; };