import type { AnyFunction, DebounceOptions, ThrottleOptions, MemoizeOptions } from "../types"; declare global { function setTimeout(callback: () => void, ms: number): number; function clearTimeout(id: number): void; } /** * Creates a function that accepts arguments of func and either invokes * func returning its result, if at least arity number of arguments have * been provided, or returns a function that accepts the remaining func arguments. * * @param func - The function to curry * @param arity - The arity of func * @returns Returns the new curried function * * @example * const abc = (a, b, c) => [a, b, c]; * * const curried = curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] */ export declare function curry(func: T, arity?: number): any; /** * This method is like `curry` except that arguments are applied to func * in the manner of `partialRight` instead of `partial`. * * @param func - The function to curry * @param arity - The arity of func * @returns Returns the new curried function */ export declare function curryRight(func: T, arity?: number): any; /** * Enhanced curry with placeholder support (like Ramda's curry). * This is an advanced utility beyond standard Lodash. * * @param func - The function to curry * @returns Returns the new curried function with placeholder support * * @example * const greet = (greeting, name, punctuation) => greeting + ' ' + name + punctuation; * const curriedGreet = curryWithPlaceholders(greet); * * const sayHello = curriedGreet('Hello'); * sayHello('John', '!'); // => 'Hello John!' * * // With placeholders * const excitedly = curriedGreet(curry.placeholder, curry.placeholder, '!'); * excitedly('Hello', 'John'); // => 'Hello John!' */ export declare function curryWithPlaceholders(func: T): T & { placeholder: symbol; }; /** * Creates a debounced function that delays invoking func until after wait * milliseconds have elapsed since the last time the debounced function was invoked. * * @param func - The function to debounce * @param wait - The number of milliseconds to delay * @param options - The options object * @returns Returns the new debounced function * * @example * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); */ export declare function debounce(func: T, wait?: number, options?: DebounceOptions): T & { cancel(): void; flush(): any; }; /** * Creates a throttled function that only invokes func at most once per * every wait milliseconds. * * @param func - The function to throttle * @param wait - The number of milliseconds to throttle invocations to * @param options - The options object * @returns Returns the new throttled function * * @example * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * const throttled = throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); */ export declare function throttle(func: T, wait?: number, options?: ThrottleOptions): T & { cancel(): void; flush(): any; }; /** * Creates a function that memoizes the result of func. If resolver is * provided, it determines the cache key for storing the result based on * the arguments provided to the memoized function. * * @param func - The function to have its output memoized * @param resolver - The function to resolve the cache key * @returns Returns the new memoized function * * @example * const object = { 'a': 1, 'b': 2 }; * const other = { 'c': 3, 'd': 4 }; * * const values = memoize(values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] */ export declare function memoize(func: T, resolver?: (...args: Parameters) => string): T & { cache: Map>; }; /** * Enhanced memoize with TTL (time-to-live) expiration. * This is an advanced utility beyond standard Lodash. * * @param func - The function to have its output memoized * @param options - The memoize options * @returns Returns the new memoized function with TTL support * * @example * const expensiveOperation = (x) => { * console.log('Computing...'); * return x * 2; * }; * * const memoizedWithTTL = memoizeWithTTL(expensiveOperation, { * ttl: 5000, // 5 seconds * maxSize: 100 * }); * * memoizedWithTTL(5); // Computes and caches * memoizedWithTTL(5); // Returns from cache * // After 5 seconds... * memoizedWithTTL(5); // Computes again */ export declare function memoizeWithTTL(func: T, options?: MemoizeOptions): T & { cache: Map; expiry: number; }>; clear(): void; }; /** * Creates a function that negates the result of the predicate func. * * @param predicate - The predicate to negate * @returns Returns the new negated function * * @example * function isEven(n) { * return n % 2 == 0; * } * * filter([1, 2, 3, 4, 5, 6], negate(isEven)); * // => [1, 3, 5] */ export declare function negate boolean>(predicate: T): (...args: Parameters) => boolean; /** * Creates a function that invokes func with the this binding of the * created function and the array of arguments much like Function#apply. * * @param func - The function to spread arguments over * @returns Returns the new function * * @example * const say = spread(function(who, what) { * return who + ' says ' + what; * }); * * say(['fred', 'hello']); * // => 'fred says hello' */ export declare function spread any>(func: T): (argsArray: Parameters) => ReturnType; /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @param func - The function to cap arguments for * @returns Returns the new capped function * * @example * map(['6', '8', '10'], unary(parseInt)); * // => [6, 8, 10] */ export declare function unary(func: (arg: T, ...args: any[]) => U): (arg: T) => U;