Wrapping a JavaScript function is not as simple as one might think. Some of the issues you might encounter include:
- keeping the original function
name
- keeping the original function static properties and inherited properties
- showing the original function's body when using
String(function)
mimic-fn
is a small utility by sindresorhus tackling this issue.
Top comments (0)