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 17 | 5x 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 };
|