Created
May 9, 2020 20:58
-
-
Save baranovxyz/7fe89a1254b38ebb7f3796409f39d09c 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 trampoline(f) { | |
return function trampolined(...args) { | |
let result = f.bind(null, ...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