Created
June 9, 2020 15:01
-
-
Save jsmanifest/9aa2b8ff9ed010999fd0362d5c7ebb97 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 makeInjectContext(context) { | |
return function (callback) { | |
return function (...args) { | |
let result = callback(...args) | |
if (typeof result === 'function') { | |
// Call it again and inject additional options | |
result = result(context) | |
} | |
return result | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment