Created
March 6, 2022 16:18
-
-
Save alpercitak/bb123ead2fd6ad25f00a4439a066bd2e to your computer and use it in GitHub Desktop.
intercept function - call another function with original result & parameters
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
const add = (key, fn) => { | |
fn = (() => { | |
let original_fn = fn; | |
return (...params) => { | |
const original_result = original_fn.apply(this, params); | |
return another_func(...original_result); | |
}; | |
})(); | |
}; | |
add("method1", (id) => [`/users/${id}`]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment