Created
March 28, 2019 10:33
-
-
Save lupuszr/0b8aaca489c242d080a7b42b058793c5 to your computer and use it in GitHub Desktop.
trampoline
This file contains 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
const trampoline = fn => (...args) => { | |
let result = fn(...args) | |
while (typeof result === 'function') { | |
result = result() | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment