const add = (a, b) => a + b
const dbl = (num) => num * 2
const pipe = (f, g) => (...args) => g(f(...args))
const sumThenDbl = pipe(add, dbl)
const result = sumThenDbl(2, 1) // 6
Created
September 10, 2018 14:09
-
-
Save Ugarz/964309586ad2d35d21da16763732b82f to your computer and use it in GitHub Desktop.
Piping functions in javacript
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment