All files / src/_util call-both.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12  347x   8x 16x 12x     8x      
export function callBoth<T extends (...args: any[]) => any>(...fns: T[]): T {
  return ((...args: any[]) => {
    let lastResult: any;
    for (const fn of fns) {
      if (typeof fn === "function") {
        lastResult = fn(...args);
      }
    }
    return lastResult;
  }) as T;
}