import { PreparedEvents } from '../config/definitions/parts/events';
declare type AnyFunction = (...args: any[]) => any;
export declare type EventInvokerAsync
= (...args: Parameters
) => Promise;
export declare type EventInvokerSync = (...args: Parameters
) => any;
export default class FuncUtils {
/**
* Creates an async closure for invoking async functions in a chain.
* @param functions
* @param breakChainOn
* Indicates if the chain execution should stop when a function has returned some value
* (value is also returned from the invoker) or when the provided function returns true.
*/
static createAsyncChainInvoker(functions: T[], breakChainOn: "ReturnValue" | false | ((...args: Parameters) => boolean)): EventInvokerAsync;
/**
* Creates an async closure for invoke a function or functions.
* @param func
*/
static createFuncAsyncInvoker(func: T[] | T): EventInvokerAsync;
/**
* Creates an async closure for invoking functions.
* @param functions
*/
static createFuncArrayAsyncInvoker(functions: T[]): EventInvokerAsync;
/**
* Creates an sync closure for invoke a function or functions.
* @param func
*/
static createFuncSyncInvoker(func: T[] | T): EventInvokerSync;
/**
* Creates an sync closure for invoke a function.
* @param functions
*/
static createFuncArraySyncInvoker(functions: T[]): EventInvokerSync;
/**
* Creates a function safe caller which catch thrown errors,
* log them and triggers the error event.
* @param func
* @param errorEvent
* @param beforeErrorMsg
*/
static createSafeCaller(func: T, beforeErrorMsg?: string, errorEvent?: PreparedEvents['error']): EventInvokerAsync;
/**
* Calls a function safe.
* It means that all thrown errors will be caught.
* In this case, the failureReturnValue will be returned.
* @param func
* @param args
* @param failureReturnValue
*/
static callSafe any, FR>(func: T, args: Parameters, failureReturnValue: FR): ReturnType | FR;
}
export {};