@project44-manifest/react
Version:
Manifest Design System react components
15 lines (13 loc) • 333 B
text/typescript
import type { Callback } from './types';
/**
* Merge all callbacks into a single callback function.
*/
export function mergeCallbacks<T extends unknown[]>(...fns: Callback<T>[]): Callback<T> {
return (...args: T) => {
for (const fn of fns) {
if (typeof fn === 'function') {
fn?.(...args);
}
}
};
}