/* IMPORT */ import debounce from './debounce.js'; import type {FN, Throttled} from './types.js'; /* MAIN */ const throttle = ( fn: FN, wait: number = 1, options?: { leading?: boolean, trailing?: boolean } ): Throttled => { return debounce ( fn, wait, { maxWait: wait, leading: options?.leading ?? true, trailing: options?.trailing ?? true }); }; /* EXPORT */ export default throttle;