callIfFunction.tsx 172 B

1234
  1. // Checks if `fn` is a function and calls it with `args`
  2. export function callIfFunction(fn: any, ...args: any[]): any {
  3. return typeof fn === 'function' && fn(...args);
  4. }