Pipe JS functions

PHOTO EMBED

Sun Dec 26 2021 19:54:27 GMT+0000 (UTC)

Saved by @Explosion #javascript #function_manipulation

function pipe(...functions) {
    return (...args) => functions.reduce((acc, curr, idx) => idx === 0 ? curr(...args) : curr(acc), args)
}
content_copyCOPY