Created
May 3, 2020 15:21
-
-
Save pixelkritzel/d188d4fecbc04f48f95f72ccd1cea88b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ready(payload) { | |
let lastReturnValue = payload; | |
function steady(fn) { | |
lastReturnValue = fn(lastReturnValue) | |
return { | |
steady, | |
get value() { | |
return lastReturnValue | |
} | |
} | |
} | |
return { | |
steady | |
} | |
} | |
console.log( | |
ready('Hello, I am ready steady go') | |
.steady(text => Array.from(text)) | |
.steady(arr => arr.reverse()) | |
.steady(arr => arr.map(c => c.toUpperCase())) | |
.steady(arr => arr.join(' ')) | |
.value | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment