Skip to content

Instantly share code, notes, and snippets.

View terkelg's full-sized avatar
🔵
Git'n stuff done

Terkel terkelg

🔵
Git'n stuff done
View GitHub Profile
@terkelg
terkelg / pipe.js
Created January 9, 2024 14:31
pipe function Pipe function that allows you to chain multiple operations together by taking a series of functions as arguments and applying them in a specific order to the input.
const surprise = (...fns) => input => fns.reduce(
(acc, fn) => fn(acc), input
)
// -> const formatString = pipe(toUpperCase, removeSpaces, addExclamation)