Skip to content

Instantly share code, notes, and snippets.

View karolisgrinkevicius's full-sized avatar

Karolis Grinkevičius karolisgrinkevicius

View GitHub Profile
{"label":"Test Coverage","message":"100%","schemaVersion":1,"color":"green","namedLogo":"vitest","logoColor":"white"}
type PipeFunctionArg = (...args: any[]) => object;
export const pipe = (...functions: PipeFunctionArg[]) => (...args: any[]) =>
functions.reduce((arg: any, fn: PipeFunctionArg) => (arg.length ? fn(...arg) : fn(arg)), args);