(wrapper: TWrapper, wrapped: TWrapped)
| 56 | }; |
| 57 | |
| 58 | function wrap< |
| 59 | TWrapper extends AnyFunction, |
| 60 | TWrapped extends AnyFunction, |
| 61 | >(wrapper: TWrapper, wrapped: TWrapped): TWrapper { |
| 62 | // Allow the wrapper to be used as a constructor function, just in case |
| 63 | // the wrapped function was meant to be used as a constructor. |
| 64 | wrapper.prototype = wrapped.prototype; |
| 65 | |
| 66 | // https://medium.com/@cramforce/on-the-awesomeness-of-fn-displayname-9511933a714a |
| 67 | const name = wrapped.displayName || wrapped.name; |
| 68 | if (name) { |
| 69 | wrapper.displayName = name; |
| 70 | } |
| 71 | |
| 72 | return wrapper; |
| 73 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…