/** * FUNCTION HELPERS ============================================================ * ============================================================================= */ /** * Checks if passed argument is of type function. * * @param {any} value - to check * @return {boolean} true - if it's a normal async or generator unction, including class methods */ export function isFunction(value: any): boolean; export function isAsyncFunction(value: any): boolean; export function isGeneratorFunction(value: any): boolean; /** * Check for a Valid Enumerable Value and Throw Error If It's Not * * @param {Array} enums - valid enum values * @param {*} value - variable to check against enum * @param {Function} [self] - optional, the caller function's ${this} context */ export function enumCheck(enums: any[], value: any, self?: Function | undefined): void; /** * Check if values provided do match, using given comparison operator * * @param {string} type - comparison operator (i.e. enum(['AND', 'OR'])) * @return {function} that takes boolean arguments and return true or false based on match type */ export function matchByType(type: string): Function; /** * Decorates a class method so that it is debounced by the specified duration * @Note: * - the method will have to bind manually, and cannot be defined as class property arrow function * - see `debounce()` method for docs * * @example: * class Search extends Component { * @debounceBy(200) * handleSearch () {...} * } * * @param {Number} [duration] - milliseconds to delay * @param {Object} [options] - for debounce * @returns {Function} decorator - for class method */ export function debounceBy(duration?: number | undefined, options?: Object | undefined): Function; /** * Decorates a class method so that it is throttled by the specified duration * @Note: * - the method will have to bind manually, and cannot be defined as class property arrow function * - see `throttle()` method for docs * * @example: * class Search extends Component { * @throttleBy(200) * handleSearch () {...} * } * * @param {Number} [duration] - milliseconds to delay * @param {Object} [options] - for throttle * @returns {Function} decorator - for class method */ export function throttleBy(duration?: number | undefined, options?: Object | undefined): Function; /** * Delay given Function execution * * @param {Function} func - to call * @param {Number} [wait] - milliseconds to delay * @param {Boolean} [leading] - whether to execute the Function immediately first * @returns {function(...[*]=)} - debounced */ export function debounce(func: Function, wait?: number | undefined, { leading }?: boolean | undefined): (arg0: [any][] | undefined) => any; /** * A wrapper around the lodash's throttle function. * @see https://lodash.com/docs/4.17.2#throttle for further information. * @param {Function} func - to call * @param {Number} [wait] - milliseconds to delay * @param {Object} [options] - default is {leading: true, trailing: true} * @returns {function(...[*]=)} - throttled */ export function throttle(func: Function, wait?: number | undefined, options?: Object | undefined): (arg0: [any][] | undefined) => any; /** * Throttle Function execution to call once per rendered frame * @param {function} func - to call * @returns {function} function - throttled to once per frame */ export function throttlePerFrame(func: Function): Function; export const asyncFuncConstructor: Function; export const generatorFuncConstructor: Function; export namespace testMock { const i: number; const dayCount: number; const hourCount: number; }