/** * Async utilities module * * @module async * * @example * Import async utilities: * ```typescript * import { filterAsync, mapAsync, replaceAsync } from '@vvlad1973/utils'; * ``` */ /** * Filters an array asynchronously using a predicate function * * @template T - Type of array elements * @param array - Array to filter * @param predicate - Async predicate function * @returns Promise resolving to filtered array * * @example * ```typescript * const numbers = [1, 2, 3, 4, 5]; * const result = await filterAsync(numbers, async (n) => n > 2); * // result: [3, 4, 5] * ``` */ export declare function filterAsync(array: T[] | undefined, predicate: (item: T, index: number, array: T[]) => Promise | boolean): Promise; /** * Maps an array asynchronously using a mapper function * * @template T - Type of input array elements * @template U - Type of output array elements * @param array - Array to map * @param mapper - Async mapper function * @returns Promise resolving to mapped array * * @example * ```typescript * const numbers = [1, 2, 3]; * const result = await mapAsync(numbers, async (n) => n * 2); * // result: [2, 4, 6] * ``` */ export declare function mapAsync(array: T[] | undefined, mapper: (item: T, index: number, array: T[]) => Promise | U): Promise; /** * Replaces all matches in a string asynchronously * * @param str - Input string * @param regex - Regular expression to match * @param replacer - Async replacer function * @returns Promise resolving to the replaced string * * @example * ```typescript * const text = "hello world"; * const result = await replaceAsync(text, /\w+/g, async (match) => match.toUpperCase()); * // result: "HELLO WORLD" * ``` */ export declare function replaceAsync(str: string, regex: RegExp, replacer: (match: string, ...args: any[]) => Promise | string): Promise;