@julo-ui/function-utils
Version:
Function Utilities across Julo UI package
29 lines (27 loc) • 722 B
TypeScript
/**
* Helper to help execute multiple function in HOF way
*
* @remarks
* [HOF](https://www.freecodecamp.org/news/higher-order-functions-in-javascript/)
*
* @param fns - Array of function that need to be executed
*
* @returns method - function to execute all fn that is passed
*
* @example
* ```tsx
*
* const ExtendComponent = (props: ExtendComponentProps) => {
* const {onClick, ...resProps} = props;
*
* function defaultOnClick() {
* // some code
* }
*
* return <Component onClick={callAllFn(defaultOnClick, onClick)} {...resProps}/>
* }
*
* ```
*/
declare function callAllFn<T = unknown>(...fns: Array<undefined | Function>): (...args: T[]) => void;
export { callAllFn as default };