All files / fns index.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
100% Lines 8/8

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 13 14 15 16 175x 420x     5x 20x 20x   20x 40x     20x        
const interleave = <T, K>(list: readonly T[], item: K): (T | K)[] =>
  list.flatMap((node) => [node, item]).slice(0, -1);
 
const pipe =
  <T>(...functions: readonly ((value: T) => T)[]) =>
  (initialValue: T): T => {
    let result = initialValue;
 
    for (const functionInPipe of functions) {
      result = functionInPipe(result);
    }
 
    return result;
  };
 
export { interleave, pipe };