Language concepts

Function pipeline

Try the free JavaScript compiler

Left-to-right synchronous composition of unary transformations. An empty pipeline is the identity operation; promises need explicit handling.

Formal Syntax & Structure

javascript syntaxjavascript
(...fs) => x => fs.reduce((v,f)=>f(v),x)

Working Example

Example Snippetjavascript
const pipe=(...fs)=>x=>fs.reduce((v,f)=>f(v),x);console.log(pipe(x=>x*2,x=>x+1)(3));
JavaScript Reference